UNPKG

site-metadata-extractor

Version:
39 lines (38 loc) 1.52 kB
/// <reference types="cheerio" /> /// <reference types="node" /> import { NewsArticle, Article } from "schema-dts"; import { URL } from "url"; export interface LinkObj { href: string; text: string; } export interface VideoAttrs { height?: string; src?: string; width?: string; } export interface Extractor { author: (doc: cheerio.Root) => string[]; calculateBestNode: (doc: cheerio.Root, lang: string) => cheerio.Cheerio; canonicalLink: (doc: cheerio.Root, resourceUrl: string) => string; copyright: (doc: cheerio.Root) => string; date: (doc: cheerio.Root) => string; description: (doc: cheerio.Root) => string; favicon: (doc: cheerio.Root, resourceUrlObj: URL) => string; image: (doc: cheerio.Root) => string; jsonld: (doc: cheerio.Root) => NewsArticle | Article | null; keywords: (doc: cheerio.Root) => string; lang: (doc: cheerio.Root) => string; links: (doc: cheerio.Root, topNode: cheerio.Cheerio, lang: string) => LinkObj[]; locale: (doc: cheerio.Root) => string; publisher: (doc: cheerio.Root) => string; siteName: (doc: cheerio.Root) => string; softTitle: (doc: cheerio.Root) => string; tags: (doc: cheerio.Root) => string[]; text: (doc: cheerio.Root, topNode: cheerio.Cheerio, lang: string) => string; title: (doc: cheerio.Root) => string; type: (doc: cheerio.Root) => string; videos: (doc: cheerio.Root, topNode: cheerio.Cheerio) => VideoAttrs[]; } declare const extractor: Extractor; export default extractor;