UNPKG

@alline/hook-wiki

Version:

Wikipedia hook for Alline.

26 lines (25 loc) 1.08 kB
/// <reference types="cheerio" /> import { Episode } from "@alline/model"; import { EpisodeContext } from "@alline/core"; import { RequestContext } from "@alline/scraper-request"; export interface Option { id: string; offset?: number; multipleRow?: number; mapping?: Partial<{ title: number; aired: number; directors: number; writers: number; }>; parsers?: Partial<{ title: (elements: CheerioElement[]) => string[]; aired: (elements: CheerioElement[]) => string; directors: (elements: CheerioElement[]) => string[]; writers: (elements: CheerioElement[]) => string[]; }>; validate?: (table: CheerioElement[][]) => void; } export declare const transformEpisodeHook: (option: Option) => (data: Episode, ctx: RequestContext<CheerioStatic, string>) => Episode; export declare const transformUrlHook: (language: string, topic: string) => (_: string, ctx: EpisodeContext) => string; export declare const validateText: (cells: [number, number, string][]) => (table: CheerioElement[][]) => void;