mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function c(e){try{s(o.next(e))}catch(e){i(e)}}function a(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(c,a)}s((o=o.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0;const getEpisodes=function(e){return __awaiter(this,arguments,void 0,function*({url:e,providerContext:t}){const{axios:n,cheerio:o,commonHeaders:r}=t;try{const t=yield n.get(e,{headers:r}),i=o.load(t.data),c=i(".entry-content,.entry-inner");i(".unili-content,.code-block-1").remove();const a=[];return c.find("h4").each((e,t)=>{const n=i(t),o=n.text().replace(/-/g,"").replace(/:/g,""),r=n.next("p").find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]').parent().attr("href");o&&r&&a.push({title:o,link:r})}),a}catch(e){return[]}})};exports.getEpisodes=getEpisodes; |