UNPKG

@lzwme/m3u8-dl

Version:

A free, open-source, and powerful m3u8 video batch downloader with multi-threaded downloading, play-while-downloading, WebUI management, video parsing, and more.

45 lines (44 loc) 1.47 kB
import type { SearchApi, VideoDetailsResult, VideoSearchResult } from '../../types'; import type { M3u8StorConfig } from '../storage.js'; export interface VSOptions { /** 采集站地址 */ api?: string; /** 站点描述 */ desc?: string; /** 是否启用 */ enable?: 0 | 1 | boolean; } /** * 基于采集站点 API 的通用搜索 * @example * ```ts * const v = new CommSearchApi({ api: 'https://api.xinlangapi.com/xinlangapi.php/provide/vod/' }); * v.search('三体') * .then(d => { * console.log(d.total, d.list); * return v.getVideoList(d.list[0].vod_id); * }) * .then(d => { * console.log('detail:', d.total, d.list[0]); * }); * ``` */ export declare class CommSearchApi implements SearchApi { protected options: VSOptions; protected currentUrl: M3u8StorConfig['remoteConfig']['data']['apiSites'][0]; apiMap: Map<string, { url: string; desc?: string; enable?: 0 | 1 | boolean; remote?: boolean; }>; get desc(): string; get key(): string; get enable(): boolean; constructor(options?: VSOptions); search(wd: string, api?: string): Promise<VideoSearchResult>; detail(id: string | number, api?: string): Promise<VideoDetailsResult>; /** 按 id 取列表(每一项中包含了更为详细的内容) */ getVideoList(ids: number | string | (number | string)[], api?: string): Promise<VideoDetailsResult>; private formatUrl; }