mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +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{_(r.next(e))}catch(e){s(e)}},a=e=>{try{_(r.throw(e))}catch(e){s(e)}},_=e=>e.done?o(e.value):Promise.resolve(e.value).then(n,a);_((r=r.apply(e,t)).next())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var getPosts=__name(function(e){return __async(this,arguments,function*({filter:e,page:t,signal:r,providerContext:o}){const{getBaseUrl:s}=o,n=yield s("filmyfly");return posts({url:`${n+e}/${t}`,signal:r,baseUrl:n,providerContext:o})})},"getPosts"),getSearchPosts=__name(function(e){return __async(this,arguments,function*({searchQuery:e,page:t,signal:r,providerContext:o}){const{getBaseUrl:s}=o,n=yield s("filmyfly");return t>1?[]:posts({url:`${n}/site-1.html?to-search=${e}`,signal:r,baseUrl:n,providerContext:o})})},"getSearchPosts");function posts(e){return __async(this,arguments,function*({url:e,signal:t,baseUrl:r,providerContext:o}){try{const{cheerio:s,commonHeaders:n}=o,a=yield fetch(e,{headers:n,signal:t}),_=yield a.text(),p=s.load(_),c=[];return p(".A2,.A10,.fl").map((e,t)=>{const o=p(t).find("a").eq(1).text()||p(t).find("b").text(),s=p(t).find("a").attr("href"),n=p(t).find("img").attr("src");o&&s&&n&&c.push({title:o,link:r+s,image:n})}),c}catch(e){return[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts; |