mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
1.9 KiB
JavaScript
1 line
1.9 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 r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===r||__defProp(e,s,{get:()=>t[s],enumerable:!(o=__getOwnPropDesc(t,s))||o.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,r)=>new Promise((o,s)=>{var n=e=>{try{p(r.next(e))}catch(e){s(e)}},i=e=>{try{p(r.throw(e))}catch(e){s(e)}},p=e=>e.done?o(e.value):Promise.resolve(e.value).then(n,i);p((r=r.apply(e,t)).next())}),episodes_exports={};function getEpisodeLinks(e){return __async(this,arguments,function*({url:e,providerContext:t}){try{const r=yield t.axios.get(e),o=t.cheerio.load(r.data||""),s=[];return o("h4.fittexted_for_content_h4").each((t,r)=>{const n=o(r).text().trim();n&&o(r).nextUntil("h4, hr").find("a[href]").each((t,r)=>{let i=(o(r).attr("href")||"").trim();if(!i)return;i.startsWith("http")||(i=new URL(i,e).href);const p=o(r).text().trim()||"Watch Episode",_=i.toLowerCase();(_.includes("skydro")||_.includes("flexplayer.buzz"))&&s.push({title:`${n} - ${p}`,link:i})})}),s.sort((e,t)=>{var r,o;return parseInt((null==(r=e.title.match(/\d+/))?void 0:r[0])||"0")-parseInt((null==(o=t.title.match(/\d+/))?void 0:o[0])||"0")}),s}catch(e){return[]}})}function getEpisodes(e){return __async(this,arguments,function*({url:e,providerContext:t}){return yield getEpisodeLinks({url:e,providerContext:t})})}__export(episodes_exports,{getEpisodeLinks:()=>getEpisodeLinks,getEpisodes:()=>getEpisodes}),__name(getEpisodeLinks,"getEpisodeLinks"),__name(getEpisodes,"getEpisodes"),exports.getEpisodeLinks=getEpisodeLinks,exports.getEpisodes=getEpisodes; |