mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===o||__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,o)=>new Promise((r,s)=>{var n=e=>{try{_(o.next(e))}catch(e){s(e)}},p=e=>{try{_(o.throw(e))}catch(e){s(e)}},_=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,p);_((o=o.apply(e,t)).next())}),episodes_exports={};__export(episodes_exports,{getEpisodes:()=>getEpisodes});var getEpisodes=__name(function(e){return __async(this,arguments,function*({url:e,providerContext:t}){const{axios:o,cheerio:r}=t;try{const t=(yield o.get(e)).data,s=r.load(t),n=[];return s("table tbody tr").each((e,t)=>{const o=s(t).find("td:first-child a"),r=o.text().trim(),p=o.attr("href");if(r&&p&&"../"!==r&&"Parent Directory"!==r&&(r.includes(".mp4")||r.includes(".mkv")||r.includes(".avi")||r.includes(".mov"))){const e=p;let t=r;const o=r.match(/[Ss](\d+)[Ee](\d+)/),s=r.match(/[Ee](\d+)/);if(o)t=`S${o[1]}E${o[2]} - ${r}`;else if(s)t=`Episode ${s[1]} - ${r}`;else{const e=r.match(/(\d+)/);e&&(t=`Episode ${e[1]} - ${r}`)}n.push({title:t,link:e})}}),n}catch(e){return[]}})},"getEpisodes");exports.getEpisodes=getEpisodes; |