UNPKG

oto-scraper

Version:

multi scraper

20 lines (15 loc) 587 B
const axios = require('axios'); const { youtube } = require('../src/Constants'); async function yt_infovid_fetch(param, options = {}) { if(requestedLang && typeof requestedLang !== 'string') { throw new TypeError("The request language property was not a string while a valid IANA language subtag is expected."); } if(options.paramType === "id") { youtube.YouTubeURL.pathname = "watch"; youtube.YouTubeURL.search = new URLSearchParams({ v: param }); } else { youtube.YouTubeURL.href = param; } }