{"version":3,"sources":["jsdelivr-header.js","/npm/metascraper-youtube@5.49.24/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,MAAM,aAAe,QAAQ,iBACvB,WAAa,QAAQ,gBACrB,QAAU,QAAQ,aAElB,QACJ,QAAO,OACP,OAAM,WACN,WAAU,MACV,MAAK,OACL,QACE,QAAQ,wBAEN,sBAAwB,CAC5B,oBACA,gBACA,gBACA,gBACA,eAGI,gBAAkB,CAAC,EAAI,KAC3B,MAAM,EAAO,sBAAsB,KACjC,GAAO,8BAA8B,KAAM,MAG7C,OAAO,QAAQ,GAAM,SACnB,aAAa,kBAAkB,aAAa,EAAK,KACnD,EAGI,SAAW,OAAO,QAElB,QAAU,OAAO,OAEjB,aAAe,WAAW,YAE1B,KAAO,YAAW,GAAqC,YAA9B,aAAa,GAAK,UAEjD,OAAO,QAAU,EAAG,WAAY,CAAC,KAC/B,MAAM,EAAQ,CACZ,MAAO,CAAC,SAAQ,GAAK,EAAE,eAAe,OAAO,QAAQ,aAAc,OACnE,OAAQ,CACN,UAAS,GAAK,QAAQ,EAAG,EAAE,6BAC3B,UAAS,GAAK,EAAE,yCAAyC,KAAK,cAEhE,UAAW,IAAM,UACjB,MAAO,CACL,EAAG,UACD,MAAM,GAAE,GAAO,WAAW,GAC1B,OAAO,GAAM,gBAAgB,EAAI,EAAO,GAK9C,KAAa,EAAG,SAAU,KAAK,GAE/B,QAAgB,uBAEhB,OAAO,GAGT,OAAO,QAAQ,KAAO","file":"/npm/metascraper-youtube@5.49.24/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/metascraper-youtube@5.49.24/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst reachableUrl = require('reachable-url')\nconst getVideoId = require('get-video-id')\nconst pLocate = require('p-locate')\n\nconst {\n  $filter,\n  author,\n  memoizeOne,\n  title,\n  toRule\n} = require('@metascraper/helpers')\n\nconst THUMBAILS_RESOLUTIONS = [\n  'maxresdefault.jpg',\n  'sddefault.jpg',\n  'hqdefault.jpg',\n  'mqdefault.jpg',\n  'default.jpg'\n]\n\nconst getThumbnailUrl = (id, gotOpts) => {\n  const urls = THUMBAILS_RESOLUTIONS.map(\n    res => `https://img.youtube.com/vi/${id}/${res}`\n  )\n\n  return pLocate(urls, async url =>\n    reachableUrl.isReachable(await reachableUrl(url, gotOpts))\n  )\n}\n\nconst toAuthor = toRule(author)\n\nconst toTitle = toRule(title)\n\nconst getVideoInfo = memoizeOne(getVideoId)\n\nconst test = memoizeOne(url => getVideoInfo(url).service === 'youtube')\n\nmodule.exports = ({ gotOpts } = {}) => {\n  const rules = {\n    title: [toTitle($ => $('title:first').text().replace(' - YouTube', ''))],\n    author: [\n      toAuthor($ => $filter($, $('[class*=\"user-info\" i]'))),\n      toAuthor($ => $('[itemprop=\"author\"] [itemprop=\"name\"]').attr('content'))\n    ],\n    publisher: () => 'YouTube',\n    image: [\n      ({ url }) => {\n        const { id } = getVideoId(url)\n        return id && getThumbnailUrl(id, gotOpts)\n      }\n    ]\n  }\n\n  rules.test = ({ url }) => test(url)\n\n  rules.pkgName = 'metascraper-youtube'\n\n  return rules\n}\n\nmodule.exports.test = test\n"]}