htmlmetaparser
Version:
A `htmlparser2` handler for parsing rich metadata from HTML. Includes HTML metadata, JSON-LD, RDFa, microdata, OEmbed, Twitter cards and AppLinks.
34 lines (33 loc) • 915 B
TypeScript
export interface Provider {
provider_name: string;
provider_url: string;
endpoints: Array<{
url?: string;
schemes?: string[];
discovery?: boolean;
formats?: string[];
}>;
}
export declare class OEmbedProviders {
matchers: OEmbedMatch[];
constructor(providers: Provider[]);
add(provider: Provider): void;
match(url: string): MatchResult | undefined;
}
export interface MatchResult {
type: string;
href: string;
}
export declare class OEmbedMatch {
routes: Array<{
matches: RegExp[];
url: string;
formats?: string[];
}>;
constructor(provider: Provider);
schemeToRegExp(scheme: string): RegExp;
urlToRegExp(url: string): RegExp;
escapeRegExp(str: string): string;
match(url: string): MatchResult | undefined;
formatResult(oembedUrl: string, url: string, formats?: string[]): MatchResult;
}