mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
3.3 KiB
JavaScript
1 line
3.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,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 i=e=>{try{l(r.next(e))}catch(e){o(e)}},n=e=>{try{l(r.throw(e))}catch(e){o(e)}},l=e=>e.done?s(e.value):Promise.resolve(e.value).then(i,n);l((r=r.apply(e,t)).next())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var headers={"Accept-Encoding":"gzip","API-KEY":"2pm95lc6prpdbk0ppji9rsqo",Connection:"Keep-Alive","If-Modified-Since":"Wed, 14 Aug 2024 13:00:04 GMT","User-Agent":"okhttp/3.14.9"},getPosts=__name(function(e){return __async(this,arguments,function*({filter:e,page:t,signal:r,providerContext:s}){try{const{axios:o,getBaseUrl:i}=s,n=yield i("dooflix"),l=[],a=n+e+`?page=${t}`,p=(yield o.get(a,{headers:headers,signal:r})).data;if(!p||"string"!=typeof p)return[];let c;try{const e=p.indexOf("["),t=p.lastIndexOf("]")+1;if(-1===e||t<=e)c=JSON.parse(p);else{const r=p.substring(e,t),s=JSON.parse(r);c=s.length>0?s:p}}catch(e){return[]}return Array.isArray(c)?(c.forEach(e=>{const t=null==e?void 0:e.videos_id;if(!t)return;const r=(null==e?void 0:e.is_tvseries)?"movie":"tvseries",s=`${n}/rest-api//v130/single_details?type=${r}&id=${t}`,o=null==e?void 0:e.thumbnail_url,i=(null==o?void 0:o.includes("https"))?o:null==o?void 0:o.replace("http","https");l.push({title:(null==e?void 0:e.title)||"",link:s,image:i})}),l):[]}catch(e){return[]}})},"getPosts"),getSearchPosts=__name(function(e){return __async(this,arguments,function*({searchQuery:e,page:t,providerContext:r,signal:s}){var o,i;try{if(t>1)return[];const{axios:n,getBaseUrl:l}=r,a=[],p=yield l("dooflix"),c=`${p}/rest-api//v130/search?q=${e}&type=movietvserieslive&range_to=0&range_from=0&tv_category_id=0&genre_id=0&country_id=0`,d=(yield n.get(c,{headers:headers,signal:s})).data;if(!d||"string"!=typeof d)return[];let u;try{const e=d.indexOf("{"),t=d.lastIndexOf("}")+1;if(-1===e||t<=e)u=d;else{const r=d.substring(e,t),s=JSON.parse(r);u=(null==s?void 0:s.movie)?s:d}}catch(e){return[]}return null==(o=null==u?void 0:u.movie)||o.forEach(e=>{const t=null==e?void 0:e.videos_id;if(!t)return;const r=`${p}/rest-api//v130/single_details?type=movie&id=${t}`,s=null==e?void 0:e.thumbnail_url,o=(null==s?void 0:s.includes("https"))?s:null==s?void 0:s.replace("http","https");a.push({title:(null==e?void 0:e.title)||"",link:r,image:o})}),null==(i=null==u?void 0:u.tvseries)||i.forEach(e=>{const t=null==e?void 0:e.videos_id;if(!t)return;const r=`${p}/rest-api//v130/single_details?type=tvseries&id=${t}`,s=null==e?void 0:e.thumbnail_url,o=(null==s?void 0:s.includes("https"))?s:null==s?void 0:s.replace("http","https");a.push({title:(null==e?void 0:e.title)||"",link:r,image:o})}),a}catch(e){return[]}})},"getSearchPosts");exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts; |