bandcamp-fetch
Version:
Scrape Bandcamp content
56 lines • 1.97 kB
TypeScript
import { type load as cheerioLoad } from 'cheerio';
import type Label from '../types/Label.js';
import type UserKind from '../types/UserKind.js';
import { type ImageFormat } from '../types/Image.js';
export interface BackToLabel {
text: string | null;
url: string;
}
export interface UrlParts {
base: string;
path: string;
query: string;
hash: string;
searchParams: URLSearchParams;
}
type CheerioSelector = ReturnType<typeof cheerioLoad>;
/**
* @internal
*
* @param $
* @returns
*/
export declare function parseLabelFromBackToLabelLink($: CheerioSelector): Label | null;
export declare function parsePublisher(json: any, imageFormat: ImageFormat | null): UserKind | null;
/**
* @internal
*
* @param url
* @param baseUrl
* @returns
*/
export declare function normalizeUrl(url: string, baseUrl?: string): string;
export declare function getAdditionalPropertyValue(o: Record<string, any>, propName: string): string | undefined;
export declare function isAbsoluteUrl(url: string): boolean;
export declare function substrAfter(str: string, after: string): string | null;
export declare function substrBefore(str: string, before: string): string | null;
export declare function splitUrl(url: string): UrlParts;
export declare function stripTags(str: string): string;
export declare function stripLineBreaks(str: string): string;
export declare function stripMultipleWhitespaces(str: string): string;
export declare function brToNewLine(str: string): string;
/**
* @internal
* Takes an image URL and returns one that corresponds to `imageFormat`.
* @param imageUrl
* @param imageFormat
* @returns
*/
export declare function reformatImageUrl(imageUrl?: string | null, imageFormat?: ImageFormat | null): string | null;
export declare class ParseError extends Error {
parseTarget?: string;
cause?: Error;
constructor(message: string, parseTarget?: string, cause?: any);
}
export {};
//# sourceMappingURL=Parse.d.ts.map