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

1 line
2.1 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,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of __getOwnPropNames(t))__hasOwnProp.call(e,o)||o===r||__defProp(e,o,{get:()=>t[o],enumerable:!(s=__getOwnPropDesc(t,o))||s.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,r)=>new Promise((s,o)=>{var n=e=>{try{i(r.next(e))}catch(e){o(e)}},a=e=>{try{i(r.throw(e))}catch(e){o(e)}},i=e=>e.done?s(e.value):Promise.resolve(e.value).then(n,a);i((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:s}){const{getBaseUrl:o,axios:n,cheerio:a}=s,i=yield o("primewire");return posts({baseUrl:i,url:`${i+e}&page=${t}`,signal:r,axios:n,cheerio:a})})},"getPosts"),getSearchPosts=__name(function(e){return __async(this,arguments,function*({searchQuery:e,page:t,signal:r,providerContext:s}){const{getBaseUrl:o,axios:n,cheerio:a,Aes:i}=s,_=__name(function(e){return __async(this,null,function*(){return yield i.sha1(e)})},"getSHA256ofJSON"),c=yield o("primewire");return posts({baseUrl:c,url:`${c}/filter?s=${e}&page=${t}&ds=${(yield _(e+"JyjId97F9PVqUPuMO0")).slice(0,10)}`,signal:r,axios:n,cheerio:a})})},"getSearchPosts");function posts(e){return __async(this,arguments,function*({baseUrl:e,url:t,signal:r,axios:s,cheerio:o}){try{const n=(yield s.get(t,{signal:r})).data,a=o.load(n),i=[];return a(".index_item.index_item_ie").map((t,r)=>{const s=a(r).find("a").attr("title"),o=a(r).find("a").attr("href"),n=a(r).find("img").attr("src")||"";s&&o&&i.push({title:s,link:e+o,image:n})}),i}catch(e){return[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;