Files
vega-providers/dist/protonMovies/posts.js
Himanshu a179a130d6 build
2026-02-03 21:48:37 +05:30

1 line
2.3 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 a=e=>{try{c(r.next(e))}catch(e){s(e)}},n=e=>{try{c(r.throw(e))}catch(e){s(e)}},c=e=>e.done?o(e.value):Promise.resolve(e.value).then(a,n);c((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,axios:a,cheerio:n}=o,c=yield s("protonMovies");return posts({url:`${c+e}/page/${t}/`,baseUrl:c,signal:r,axios:a,cheerio:n})})},"getPosts"),getSearchPosts=__name(function(e){return __async(this,arguments,function*({searchQuery:e,page:t,signal:r,providerContext:o}){const{getBaseUrl:s,axios:a,cheerio:n}=o,c=yield s("protonMovies");return posts({url:`${c}/search/${e}/page/${t}/`,baseUrl:c,signal:r,axios:a,cheerio:n})})},"getSearchPosts");function posts(e){return __async(this,arguments,function*({url:e,baseUrl:t,signal:r,axios:o,cheerio:s}){try{let a=function(e){return e.join("").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\r/g,"\r").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")};__name(a,"decodeHtml");const n=(yield o.get(e,{headers:{referer:t},signal:r})).data,c=/\[(?=.*?"<div class")(.*?)\]/g,p=null==n?void 0:n.match(c),i=a(JSON.parse(p[p.length-1])),_=s.load(i),l=[];return _(".col.mb-4").map((e,t)=>{const r=_(t).find("h5").text(),o=_(t).find("h5").find("a").attr("href"),s=_(t).find("img").attr("data-src")||_(t).find("img").attr("src")||"";r&&o&&s&&l.push({title:r,link:o,image:s})}),l}catch(e){return[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;