{"version":3,"sources":["../../youtube-video-core/node_modules/tiny-cors-proxy/src/proxy.ts","../../youtube-video-core/node_modules/tiny-cors-proxy/src/rate-limiter.ts","../../youtube-video-core/node_modules/tiny-cors-proxy/src/utils.ts","../../youtube-video-core/node_modules/tiny-cors-proxy/src/index.ts","../../youtube-video-core/src/constants.ts","../src/transcription.ts","../../youtube-video-core/src/errors.ts","../../youtube-video-core/src/utils.ts","../../youtube-video-core/src/proxy.ts","../../youtube-video-core/src/core.ts","../../youtube-video-core/src/index.ts","../src/transcriptor.ts","../src/index.ts"],"sourcesContent":["var net = null;\r\nvar url = null;\r\nvar httpProxy = null;\r\nvar http = null;\r\nvar https = null;\r\nvar getProxyForUrl = null;\r\n\r\nif(typeof module !== 'undefined' && module.exports) {\r\n    net = require('net');\r\n    url = require('url');\r\n    httpProxy = require('http-proxy');\r\n    http = require('http');\r\n    https = require('https');\r\n    getProxyForUrl = require('proxy-from-env').getProxyForUrl;\r\n}\r\n\r\ninterface Location {\r\n    protocol: string | null;\r\n    host: string | null;\r\n    hostname: string | null;\r\n    port: string | null;\r\n    path: string;\r\n    href: string;\r\n}\r\n\r\ninterface CorsProxyRequestState {\r\n    location: Location;\r\n    getProxyForUrl: typeof getProxyForUrl;\r\n    maxRedirects: number;\r\n    corsMaxAge: number;\r\n    redirectCount_?: number;\r\n    proxyBaseUrl?: string;\r\n}\r\n\r\ninterface CorsProxyOptions {\r\n    handleInitialRequest?: (req: any, res: any, location: Location) => boolean;\r\n    getProxyForUrl?: typeof getProxyForUrl;\r\n    maxRedirects?: number;\r\n    originBlacklist?: string[];\r\n    originWhitelist?: string[];\r\n    httpProxyOptions?: any;\r\n    httpsOptions?: any;\r\n    checkRateLimit?: (origin: string) => string | null;\r\n    redirectSameOrigin?: boolean;\r\n    requireHeader?: string | string[] | null;\r\n    removeHeaders?: string[];\r\n    setHeaders?: Record<string, string>;\r\n    corsMaxAge?: number;\r\n}\r\n\r\nfunction isValidHostName(hostname: string): boolean {\r\n    return !!(\r\n        net.isIPv4(hostname) ||\r\n        net.isIPv6(hostname)\r\n    );\r\n}\r\n\r\nfunction withCORS(headers: Record<string, string>, request: any): Record<string, string> {\r\n    headers['access-control-allow-origin'] = '*';\r\n    const corsMaxAge = request.corsProxyRequestState.corsMaxAge;\r\n    if (request.method === 'OPTIONS' && corsMaxAge) {\r\n        headers['access-control-max-age'] = corsMaxAge.toString();\r\n    }\r\n    if (request.headers['access-control-request-method']) {\r\n        headers['access-control-allow-methods'] = request.headers['access-control-request-method'];\r\n        delete request.headers['access-control-request-method'];\r\n    }\r\n    if (request.headers['access-control-request-headers']) {\r\n        headers['access-control-allow-headers'] = request.headers['access-control-request-headers'];\r\n        delete request.headers['access-control-request-headers'];\r\n    }\r\n\r\n    headers['access-control-expose-headers'] = Object.keys(headers).join(',');\r\n\r\n    return headers;\r\n}\r\n\r\nfunction parseURL(req_url: string): Location | null {\r\n    const match = req_url.match(/^(?:(https?:)?\\/\\/)?(([^\\/?]+?)(?::(\\d{0,5})(?=[\\/?]|$))?)([\\/?][\\S\\s]*|$)/i);\r\n    if (!match) {\r\n        return null;\r\n    }\r\n    if (!match[1]) {\r\n        if (/^https?:/i.test(req_url)) {\r\n            return null;\r\n        }\r\n        req_url = (match[4] === '443' ? 'https:' : 'http:') + '//' + req_url;\r\n    }\r\n    const parsed = url.parse(req_url);\r\n    if (!parsed.hostname) {\r\n        return null;\r\n    }\r\n    return parsed as Location;\r\n}\r\n\r\nfunction onProxyResponse(proxy: any, proxyReq: any, proxyRes: any, req: any, res: any): boolean {\r\n    const requestState: CorsProxyRequestState = req.corsProxyRequestState;\r\n\r\n    const statusCode = proxyRes.statusCode;\r\n\r\n    if (!requestState.redirectCount_) {\r\n        res.setHeader('x-request-url', requestState.location.href);\r\n    }\r\n\r\n    if (statusCode === 301 || statusCode === 302 || statusCode === 303 || statusCode === 307 || statusCode === 308) {\r\n        let locationHeader = proxyRes.headers.location;\r\n        let parsedLocation: Location | null = null;\r\n        if (locationHeader) {\r\n            locationHeader = url.resolve(requestState.location.href, locationHeader);\r\n            parsedLocation = parseURL(locationHeader);\r\n        }\r\n        if (parsedLocation) {\r\n            if (statusCode === 301 || statusCode === 302 || statusCode === 303) {\r\n                requestState.redirectCount_ = (requestState.redirectCount_ || 0) + 1;\r\n                if (requestState.redirectCount_ <= requestState.maxRedirects) {\r\n                    res.setHeader('X-CORS-Redirect-' + requestState.redirectCount_, `${statusCode} ${locationHeader}`);\r\n                    req.method = 'GET';\r\n                    req.headers['content-length'] = '0';\r\n                    delete req.headers['content-type'];\r\n                    requestState.location = parsedLocation;\r\n\r\n                    req.removeAllListeners();\r\n                    proxyReq.removeAllListeners('error');\r\n                    proxyReq.once('error', function catchAndIgnoreError() {});\r\n                    proxyReq.abort();\r\n\r\n                    proxyRequest(req, res, proxy);\r\n                    return false;\r\n                }\r\n            }\r\n            proxyRes.headers.location = `${requestState.proxyBaseUrl}/${locationHeader}`;\r\n        }\r\n    }\r\n\r\n    delete proxyRes.headers['set-cookie'];\r\n    delete proxyRes.headers['set-cookie2'];\r\n\r\n    proxyRes.headers['x-final-url'] = requestState.location.href;\r\n    withCORS(proxyRes.headers, req);\r\n    return true;\r\n}\r\n\r\nfunction proxyRequest(req: any, res: any, proxy: any): void {\r\n    const location = req.corsProxyRequestState.location;\r\n    req.url = location.path;\r\n\r\n    const proxyOptions = {\r\n        changeOrigin: false,\r\n        prependPath: false,\r\n        toProxy: false,\r\n        target: location,\r\n        headers: {\r\n            host: location.host,\r\n        },\r\n        buffer: {\r\n            pipe(proxyReq: any) {\r\n                const proxyReqOn = proxyReq.on;\r\n                proxyReq.on = function(eventName: string, listener: Function) {\r\n                    if (eventName !== 'response') {\r\n                        return proxyReqOn.call(this, eventName, listener);\r\n                    }\r\n                    return proxyReqOn.call(this, 'response', function(proxyRes: any) {\r\n                        if (onProxyResponse(proxy, proxyReq, proxyRes, req, res)) {\r\n                            try {\r\n                                listener(proxyRes);\r\n                            } catch (err) {\r\n                                proxyReq.emit('error', err);\r\n                            }\r\n                        }\r\n                    });\r\n                };\r\n                return req.pipe(proxyReq);\r\n            },\r\n        },\r\n    };\r\n\r\n    const proxyThroughUrl = req.corsProxyRequestState.getProxyForUrl(location.href);\r\n    if (proxyThroughUrl) {\r\n        proxyOptions.target = proxyThroughUrl;\r\n        proxyOptions.toProxy = true;\r\n        req.url = location.href;\r\n    }\r\n\r\n    try {\r\n        proxy.web(req, res, proxyOptions);\r\n    } catch (err) {\r\n        proxy.emit('error', err, req, res);\r\n    }\r\n}\r\n\r\nfunction getHandler(options: CorsProxyOptions, proxy: any): (req: any, res: any) => void {\r\n    const corsProxy = {\r\n        handleInitialRequest: null,\r\n        getProxyForUrl: getProxyForUrl,\r\n        maxRedirects: 5,\r\n        originBlacklist: [],\r\n        originWhitelist: [],\r\n        checkRateLimit: null,\r\n        redirectSameOrigin: false,\r\n        requireHeader: null,\r\n        removeHeaders: [],\r\n        setHeaders: {},\r\n        corsMaxAge: 0,\r\n        ...options,\r\n    };\r\n\r\n    if (corsProxy.requireHeader) {\r\n        if (typeof corsProxy.requireHeader === 'string') {\r\n            corsProxy.requireHeader = [corsProxy.requireHeader.toLowerCase()];\r\n        } else if (!Array.isArray(corsProxy.requireHeader) || corsProxy.requireHeader.length === 0) {\r\n            corsProxy.requireHeader = null;\r\n        } else {\r\n            corsProxy.requireHeader = corsProxy.requireHeader.map(function(headerName) {\r\n                return headerName.toLowerCase();\r\n            });\r\n        }\r\n    }\r\n\r\n    const hasRequiredHeaders = function(headers: Record<string, string>): boolean {\r\n        return !corsProxy.requireHeader || (Array.isArray(corsProxy.requireHeader) && corsProxy.requireHeader.some((headerName) => Object.hasOwnProperty.call(headers, headerName)));\r\n    };\r\n\r\n    return function(req: any, res: any): void {\r\n        req.corsProxyRequestState = {\r\n            getProxyForUrl: corsProxy.getProxyForUrl,\r\n            maxRedirects: corsProxy.maxRedirects,\r\n            corsMaxAge: corsProxy.corsMaxAge,\r\n        };\r\n\r\n        const cors_headers = withCORS({}, req);\r\n        if (req.method === 'OPTIONS') {\r\n            res.writeHead(200, cors_headers);\r\n            res.end();\r\n            return;\r\n        }\r\n\r\n        const location = parseURL(req.url.slice(1));\r\n\r\n        if (corsProxy.handleInitialRequest && corsProxy.handleInitialRequest(req, res, location)) {\r\n            return;\r\n        }\r\n\r\n        if (!location) {\r\n            if (/^\\/https?:\\/[^/]/i.test(req.url)) {\r\n                res.writeHead(400, 'Missing slash', cors_headers);\r\n                res.end('The URL is invalid: two slashes are needed after the http(s):.');\r\n                return;\r\n            }\r\n            res.writeHead(200, cors_headers);\r\n            res.end();\r\n            return;\r\n        }\r\n\r\n        if (location.host === 'iscorsneeded') {\r\n            res.writeHead(200, {'Content-Type': 'text/plain'});\r\n            res.end('no');\r\n            return;\r\n        }\r\n\r\n        if (location.port > '65535') {\r\n            res.writeHead(400, 'Invalid port', cors_headers);\r\n            res.end('Port number too large: ' + location.port);\r\n            return;\r\n        }\r\n\r\n        if (!/^\\/https?:/.test(req.url) && !isValidHostName(location.hostname)) {\r\n            res.writeHead(404, 'Invalid host', cors_headers);\r\n            res.end('Invalid host: ' + location.hostname);\r\n            return;\r\n        }\r\n\r\n        if (!hasRequiredHeaders(req.headers)) {\r\n            res.writeHead(400, 'Header required', cors_headers);\r\n            res.end('Missing required request header. Must specify one of: ' + corsProxy.requireHeader);\r\n            return;\r\n        }\r\n\r\n        const origin = req.headers.origin || '';\r\n        if (corsProxy.originBlacklist.indexOf(origin) >= 0) {\r\n            res.writeHead(403, 'Forbidden', cors_headers);\r\n            res.end('The origin \"' + origin + '\" was blacklisted by the operator of this proxy.');\r\n            return;\r\n        }\r\n\r\n        if (corsProxy.originWhitelist.length && corsProxy.originWhitelist.indexOf(origin) === -1) {\r\n            res.writeHead(403, 'Forbidden', cors_headers);\r\n            res.end('The origin \"' + origin + '\" was not whitelisted by the operator of this proxy.');\r\n            return;\r\n        }\r\n\r\n        const rateLimitMessage = corsProxy.checkRateLimit && corsProxy.checkRateLimit(origin);\r\n        if (rateLimitMessage) {\r\n            res.writeHead(429, 'Too Many Requests', cors_headers);\r\n            res.end('The origin \"' + origin + '\" has sent too many requests.\\n' + rateLimitMessage);\r\n            return;\r\n        }\r\n\r\n        if (corsProxy.redirectSameOrigin && origin && location.href[origin.length] === '/' &&\r\n            location.href.lastIndexOf(origin, 0) === 0) {\r\n            cors_headers.vary = 'origin';\r\n            cors_headers['cache-control'] = 'private';\r\n            cors_headers.location = location.href;\r\n            res.writeHead(301, 'Please use a direct request', cors_headers);\r\n            res.end();\r\n            return;\r\n        }\r\n\r\n        const isRequestedOverHttps = req.connection.encrypted || /^\\s*https/.test(req.headers['x-forwarded-proto']);\r\n        const proxyBaseUrl = (isRequestedOverHttps ? 'https://' : 'http://') + req.headers.host;\r\n\r\n        corsProxy.removeHeaders.forEach(function(header) {\r\n            delete req.headers[header];\r\n        });\r\n\r\n        Object.keys(corsProxy.setHeaders).forEach(function(header) {\r\n            req.headers[header] = corsProxy.setHeaders[header];\r\n        });\r\n\r\n        req.corsProxyRequestState.location = location;\r\n        req.corsProxyRequestState.proxyBaseUrl = proxyBaseUrl;\r\n\r\n        proxyRequest(req, res, proxy);\r\n    };\r\n}\r\n\r\nexport function createServer(options?: CorsProxyOptions): any {\r\n    options = options || {};\r\n\r\n    const httpProxyOptions = {\r\n        xfwd: true,\r\n        secure: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0',\r\n    };\r\n\r\n    if (options.httpProxyOptions) {\r\n        Object.keys(options.httpProxyOptions).forEach(function(option) {\r\n            httpProxyOptions[option] = options.httpProxyOptions[option];\r\n        });\r\n    }\r\n\r\n    const proxy = httpProxy.createServer(httpProxyOptions);\r\n    const requestHandler = getHandler(options, proxy);\r\n    let server;\r\n\r\n    if (options.httpsOptions) {\r\n        server = https.createServer(options.httpsOptions, requestHandler);\r\n    } else {\r\n        server = http.createServer(requestHandler);\r\n    }\r\n\r\n    proxy.on('error', function(err: Error, req: any, res: any) {\r\n        if (res.headersSent) {\r\n            if (res.writableEnded === false) {\r\n                res.end();\r\n            }\r\n            return;\r\n        }\r\n\r\n        const headerNames = res.getHeaderNames ? res.getHeaderNames() : Object.keys(res._headers || {});\r\n        headerNames.forEach(function(name) {\r\n            res.removeHeader(name);\r\n        });\r\n\r\n        res.writeHead(404, {'Access-Control-Allow-Origin': '*'});\r\n        res.end('Not found because of proxy error: ' + err);\r\n    });\r\n\r\n    return server;\r\n}\r\n","interface RateLimitChecker {\r\n    (origin: string): string | null;\r\n}\r\n\r\nexport default function createRateLimitChecker(limit: string): RateLimitChecker {\r\n    // Configure rate limit.\r\n    const rateLimitConfig = /^(\\d+) (\\d+)(?:\\s*$|\\s+(.+)$)/.exec(limit);\r\n    if (!rateLimitConfig) {\r\n        // No rate limit by default.\r\n        return (origin: string) => null;\r\n    }\r\n\r\n    const maxRequestsPerPeriod = parseInt(rateLimitConfig[1]);\r\n    const periodInMinutes = parseInt(rateLimitConfig[2]);\r\n    let unlimitedPattern: RegExp | undefined;\r\n  \r\n    const unlimitedPatternString = rateLimitConfig[3];\r\n    if (unlimitedPatternString) {\r\n        const unlimitedPatternParts = unlimitedPatternString.trim().split(/\\s+/).map(unlimitedHost => {\r\n        if (unlimitedHost.startsWith('/') && unlimitedHost.endsWith('/')) {\r\n            const regexPattern = unlimitedHost.slice(1, -1);\r\n            // Throws if the pattern is invalid.\r\n            return new RegExp(regexPattern, 'i');\r\n        } else {\r\n            // Just escape RegExp characters even though they cannot appear in a host name.\r\n            // The only actual important escape is the dot.\r\n            return unlimitedHost.replace(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&');\r\n        }\r\n      });\r\n  \r\n        const joinedPattern = unlimitedPatternParts.join('|');\r\n        unlimitedPattern = new RegExp(`^(?:${joinedPattern})$`, 'i');\r\n    }\r\n  \r\n    const accessedHosts: Record<string, number> = {};\r\n  \r\n    setInterval(() => {\r\n        Object.keys(accessedHosts).forEach(host => {\r\n            delete accessedHosts[host];\r\n        });\r\n    }, periodInMinutes * 60000);\r\n  \r\n    const rateLimitMessage = `The number of requests is limited to ${maxRequestsPerPeriod} per ${periodInMinutes === 1 ? 'minute' : periodInMinutes + ' minutes'}. Please self-host CORS Anywhere if you need more quota. See https://github.com/Rob--W/cors-anywhere#demo-server`;\r\n  \r\n    return function checkRateLimit(origin: string) {\r\n        const host = origin.replace(/^[\\w\\-]+:\\/\\//i, '');\r\n        if (unlimitedPattern && unlimitedPattern.test(host)) {\r\n            return null;\r\n        }\r\n        const count = accessedHosts[host] || 0;\r\n        accessedHosts[host] = count + 1;\r\n        if (count + 1 > maxRequestsPerPeriod) {\r\n            return rateLimitMessage;\r\n        }\r\n        return null;\r\n    };\r\n}\r\n  ","import { createServer } from \"./proxy\";\r\n\r\nexport const corsServer = createServer({\r\n    originWhitelist: [], // Allow all origins\r\n    requireHeader: ['origin', 'x-requested-with'],\r\n    removeHeaders: ['cookie', 'cookie2']\r\n});","import { createServer } from \"./proxy\";\r\nimport createRateLimitChecker from \"./rate-limiter\";\r\nimport { corsServer } from \"./utils\";\r\nexport { createServer, createRateLimitChecker, corsServer };\r\nexport default corsServer;","export const YoutubeUrl = 'https://www.youtube.com/watch';\r\nexport const YoutubeConsentUrl = 'https://consent.youtube.com/s';\r\nexport const YoutubeDislikeUrl = \"https://returnyoutubedislikeapi.com\"\r\nexport const YoutubeApiUrl = \"https://www.googleapis.com/youtube/v3\"\r\nexport const RegexExtractYoutubeVideoId = /(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/)([^\"&?\\/\\s]{11})/i;\r\nexport const RegexExtractFromXml = /<text start=\"([^\"]*)\" dur=\"([^\"]*)\">([^<]*)<\\/text>/g;\r\nexport const RegexExtractMetadataPlayer = /var\\s+ytInitialPlayerResponse\\s*=\\s*({.*?});/s;\r\nexport const RegexExtractMetadata = /var\\s+ytInitialData\\s*=\\s*({.*?});/s;\r\nexport const RegexExtractYoutubeVideoIdFromShortUrl = /(?:youtube\\.com\\/shorts\\/)([a-zA-Z0-9_-]+)/;\r\nexport const UserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36,gzip(gfe)';","export interface Transcription {\r\n    language: string;\r\n    type: string;\r\n    data : Array<{ text: string, start: number, duration : number }>;\r\n}\r\n\r\nexport class TranscriptionList {\r\n    private transcriptions: Array<Transcription> = [];\r\n\r\n    constructor(transcriptions: Array<Transcription>) {\r\n        this.transcriptions = transcriptions;\r\n    }\r\n\r\n    public list(): Array<Transcription> {\r\n        return this.transcriptions;\r\n    }\r\n\r\n    public getManual(): Transcription | undefined { \r\n        return this.transcriptions.find(t => t.type == 'manual');\r\n    }\r\n\r\n    public getAuto(): Transcription | undefined {\r\n        return this.transcriptions.find(t => t.type == 'auto');\r\n    }\r\n\r\n    public get(language: string): Transcription | undefined {\r\n        return this.transcriptions.find(t => t.language == language);\r\n    }\r\n\r\n    public getMultiple(languages: Array<string>): Array<Transcription> {\r\n        return this.transcriptions.filter(t => languages.includes(t.language));\r\n    }\r\n}","export class TranscriptionDisabledError extends Error {\r\n    constructor() {\r\n        super('Transcription is disabled for this video');\r\n    }\r\n}\r\n\r\nexport class MetricNotAvaible extends Error {\r\n    constructor() {\r\n        super('Metric is not available for this video');\r\n    }\r\n}\r\n\r\nexport class VideoUnavailableError extends Error {\r\n    constructor() {\r\n        super('Video is unavailable');\r\n    }\r\n}\r\n\r\nexport class InvalidVideoUrlError extends Error {\r\n    constructor() {\r\n        super('Invalid video url');\r\n    }\r\n}\r\n\r\nexport class InvalidLanguageError extends Error {\r\n    constructor() {\r\n        super('Invalid language');\r\n    }\r\n}\r\n\r\nexport class TooManyRequestsError extends Error {\r\n    constructor() {\r\n        super('Too many requests');\r\n    }\r\n}\r\n\r\nexport class LanguageNotAvailableError extends Error {\r\n    constructor() {\r\n        super('Language not available');\r\n    }\r\n}","export const match = (str: string, regex: RegExp) => {\r\n    const result = str.match(regex);\r\n    return result ? result[1] : null;\r\n}\r\n\r\nexport const isBrowser = () => typeof module === 'undefined' || !module.exports\r\n\r\nexport const convertToNumber = (text: string) => {\r\n    const abbreviation: { [key: string]: number } = {\r\n        'K': 1000,\r\n        'M': 1000000,\r\n        'B': 1000000000\r\n    };\r\n\r\n    const cleanedText = text.replace(/\\s/g, '').replace(/[^0-9.,KM]/gi, '');\r\n\r\n    const matches = cleanedText.match(/([0-9.]+)([KM]?)/i);\r\n    if (!matches) {\r\n        throw new Error('Invalid format');\r\n    }\r\n\r\n    const value = parseFloat(matches[1].replace(',', '.'));\r\n    const unit = matches[2].toUpperCase();\r\n\r\n    const multiplier = abbreviation[unit] || 1;\r\n    return value * multiplier;\r\n}\r\n","export interface ProxyOptions {\r\n    url: string, \r\n    headers: {} \r\n}\r\n\r\nexport default class Proxy {\r\n    protected isProxyTested: boolean = false;\r\n    protected _isProxyAvailable: boolean = false;\r\n    protected proxyHeaders: {} = {};\r\n    protected proxyUrl: string = \"\";\r\n\r\n    protected async isProxyAvailable () {\r\n        if(this.isProxyTested == false) {\r\n            try {\r\n                await fetch(this.proxyUrl);\r\n                this._isProxyAvailable = true;\r\n            } finally {\r\n                this.isProxyTested = true;\r\n            }\r\n        } \r\n        return this._isProxyAvailable;\r\n    }\r\n    \r\n    public setProxy (options : ProxyOptions) {\r\n        this.proxyUrl = options.url;\r\n        this.proxyHeaders = options.headers ?? {};\r\n        if(!this.proxyHeaders['X-Requested-With']) this.proxyHeaders['X-Requested-With'] = 'XMLHttpRequest';\r\n        this.isProxyTested = false;\r\n    }\r\n    \r\n    public async fetchThroughtProxy (url: string, option: any, isProxy = false) {\r\n        if(isProxy && await this.isProxyAvailable()){\r\n            url = `${this.proxyUrl}${url}`\r\n            if(option.headers === undefined) option.headers = {};\r\n            option.headers = { ...option.headers, ...this.proxyHeaders };\r\n        }\r\n\r\n        return fetch(url, option);\r\n    }\r\n}","import { RegexExtractYoutubeVideoId, RegexExtractYoutubeVideoIdFromShortUrl, YoutubeUrl, UserAgent, RegexExtractMetadata, RegexExtractMetadataPlayer } from \"./constants\";\r\nimport { VideoUnavailableError, TooManyRequestsError, MetricNotAvaible } from \"./errors\";\r\nimport { match, isBrowser } from \"./utils\";\r\nimport proxy, {ProxyOptions} from \"./proxy\";\r\n\r\nexport class Core {\r\n\r\n    private proxy: proxy\r\n\r\n    constructor() {\r\n        this.proxy = new proxy();\r\n    }\r\n    /**\r\n     * Fetch video page\r\n     * @param videoId Video id\r\n     */\r\n    protected async fetchVideo(videoId: string): Promise<string> {\r\n        return await this.fetchHtml(videoId);\r\n    }\r\n\r\n    public setProxy(options : ProxyOptions) {\r\n        this.proxy.setProxy(options);\r\n        return this;\r\n    }\r\n\r\n    protected async fetchHtml(videoId: string): Promise<string> {\r\n        const headers = { 'User-Agent' : UserAgent, 'Accept-Language': 'en-US' }\r\n\r\n        var url = `${YoutubeUrl}?v=${videoId}`;\r\n        const response = await this.proxy.fetchThroughtProxy(`${url}`, { headers }, isBrowser());\r\n        const page = await response.text();\r\n\r\n        if(page.includes('class=\"g-recaptcha')) {\r\n            throw new TooManyRequestsError();\r\n        }\r\n\r\n        if(!page.includes(\"playabilityStatus\")) {\r\n            throw new VideoUnavailableError();\r\n        }\r\n\r\n        return page;\r\n    }\r\n\r\n    protected async fetchMetadata(url: string): Promise<any> {\r\n        const videoId = this.getVideoId(url);\r\n\r\n        const page = await this.fetchVideo(videoId);\r\n\r\n        const player = match(page, RegexExtractMetadataPlayer);\r\n        const data = match(page, RegexExtractMetadata);\r\n        if(!player || !data) {\r\n            throw new MetricNotAvaible()\r\n        }\r\n\r\n        const metadata = { player : JSON.parse(player), data : JSON.parse(data) };\r\n        return metadata;\r\n    }\r\n\r\n    /**\r\n     * Get video id of the video for the given url\r\n     * @param url \r\n     */\r\n    protected getVideoId(url: string): string {\r\n        if(url.length == 11) {\r\n            return url;\r\n        }\r\n\r\n        const rules = [RegexExtractYoutubeVideoIdFromShortUrl, RegexExtractYoutubeVideoId];\r\n        for(const rule of rules) {\r\n            const videoId = match(url, rule);\r\n            if(!videoId) {\r\n                continue;\r\n            }\r\n\r\n            return videoId;\r\n        }\r\n\r\n        return url;\r\n    }\r\n}\r\n","import { TranscriptionDisabledError, VideoUnavailableError, InvalidVideoUrlError, InvalidLanguageError, TooManyRequestsError, LanguageNotAvailableError } from \"./errors\";\r\nimport { Core } from \"./core\";\r\nimport { isBrowser } from \"./utils\";\r\nlet Server = isBrowser() ? null : require(\"tiny-cors-proxy\");\r\nexport default new Core();\r\nexport { Core, Server, TranscriptionDisabledError, VideoUnavailableError, InvalidVideoUrlError, InvalidLanguageError, TooManyRequestsError, LanguageNotAvailableError };","import { UserAgent, RegexExtractFromXml } from \"@youtube-video-core/constants\";\r\nimport { TranscriptionList, Transcription } from \"./transcription\";\r\nimport { Core } from \"@youtube-video-core/index\";\r\n\r\nexport class Transcriptor extends Core {\r\n\r\n    constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Fetch transcript from multiple Youtube Video\r\n     * @param url Video url\r\n     * @param languages Languages to fetch\r\n     */\r\n    public async getTranscript(url: string, languages : Array<string>|string = ['en']): Promise<Transcription[]|Transcription> {\r\n        if (typeof languages === 'string') {\r\n            languages = [languages];\r\n        }\r\n\r\n        const transcripts = await this.listTranscripts(url);\r\n\r\n        const filteredTranscriptions = transcripts.getMultiple(languages);\r\n        if(filteredTranscriptions.length == 1) {\r\n            return filteredTranscriptions[0];\r\n        }\r\n\r\n        return filteredTranscriptions;\r\n    }\r\n\r\n    /**\r\n     * Fetch transcript from one Youtube Video\r\n     * @param urls Video(s) url\r\n     * @param languages Languages to fetch\r\n     */\r\n    public async getTranscripts(urls: Array<string>|string, languages: Array<string>|string = ['en']): Promise<Transcription[]>  {\r\n\r\n        if (typeof urls === 'string') {\r\n            urls = [urls]\r\n        }\r\n\r\n        const transcriptions: Transcription[] = [];\r\n        for (const url of urls) {\r\n            var transcripts = await this.getTranscript(url, languages);\r\n            if(Array.isArray(transcripts) === false) {\r\n                transcripts = [transcripts];\r\n            }\r\n\r\n            for(const transcript of transcripts) {\r\n                transcriptions.push(transcript);\r\n            }\r\n        }\r\n\r\n        return transcriptions;\r\n    }\r\n\r\n    /**\r\n     * List all transcripts from a Youtube Video\r\n     * @param url Url of the video\r\n     */\r\n    public async listTranscripts(url : string): Promise<TranscriptionList> {\r\n        const { player } = await this.fetchMetadata(url);;\r\n        const { captionTracks } = player.captions.playerCaptionsTracklistRenderer;\r\n        const transcripts: Transcription[] = [];\r\n        \r\n        for(const track of captionTracks) {\r\n            const { baseUrl, languageCode, kind } = track;\r\n            const page = await this.fetchXmlTranscript(baseUrl);\r\n            const data = [...page.matchAll(RegexExtractFromXml)].map(([, start, duration, text]) => ({ start: parseFloat(start), duration: parseFloat(duration), text }));\r\n            transcripts.push({ language: languageCode, type: kind == 'asr' ? 'auto' : 'manual', data });\r\n        }\r\n\r\n        return new TranscriptionList(transcripts);\r\n    }\r\n\r\n    private async fetchXmlTranscript(url: string): Promise<string> {\r\n        const headers = { 'User-Agent' : UserAgent, 'Accept-Language': 'en-US' }\r\n\r\n        const response = await fetch(url, { headers });\r\n        return await response.text();\r\n    }\r\n}\r\n","import { Transcriptor } from \"./transcriptor\";\r\nimport { TranscriptionList, Transcription } from \"./transcription\";\r\nimport { TranscriptionDisabledError, VideoUnavailableError, InvalidVideoUrlError, InvalidLanguageError, TooManyRequestsError, LanguageNotAvailableError } from \"@youtube-video-core/errors\";\r\nexport default new Transcriptor;\r\nexport { Transcriptor, TranscriptionList, Transcription, TranscriptionDisabledError, VideoUnavailableError, InvalidVideoUrlError, InvalidLanguageError, TooManyRequestsError, LanguageNotAvailableError };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,gBAAgB,UAA2B;AAChD,SAAO,CAAC,EACJ,IAAI,OAAO,QAAQ,KACnB,IAAI,OAAO,QAAQ;AAE3B;AAEA,SAAS,SAAS,SAAiC,SAAsC;AACrF,UAAQ,6BAA6B,IAAI;A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