UNPKG

@ormoshe/js-video-url-parser

Version:

A parser to extract provider, video id, starttime and others from YouTube, Vimeo, ... urls

24 lines (19 loc) 612 B
import Provider from './provider/base-provider'; export interface Options { videoInfo: VideoInfo; params?: 'internal' | Record<string, any>; format?: string; } export interface VideoInfo<UrlParameters = Record<string, any>, MediaTypes = string> { provider?: string; id: string; mediaType?: MediaTypes; params?: UrlParameters; } export default class UrlParser { plugins: Record<string, Provider>; parseProvider(url: string): string | undefined; parse(url: string): VideoInfo | undefined; bind(plugin: Provider): void; create(op: Options): string | undefined; }