mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
2.2 KiB
JavaScript
1 line
2.2 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 o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===o||__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,o)=>new Promise((r,s)=>{var n=e=>{try{i(o.next(e))}catch(e){s(e)}},a=e=>{try{i(o.throw(e))}catch(e){s(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,a);i((o=o.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:o,providerContext:r}){const{axios:s}=r;return posts({url:("https://backend.animetsu.to"+e+"&page="+t.toString()).toString(),signal:o,axios:s})})},"getPosts"),getSearchPosts=__name(function(e){return __async(this,arguments,function*({searchQuery:e,page:t,signal:o,providerContext:r}){const{axios:s}=r;return posts({url:`https://backend.animetsu.to/api/anime/search?query=${encodeURIComponent(e)}&page=${t}&perPage=35&year=any&sort=favourites&season=any&format=any&status=any`,signal:o,axios:s})})},"getSearchPosts");function posts(e){return __async(this,arguments,function*({url:e,signal:t,axios:o}){var r;try{const s=null==(r=(yield o.get(e,{signal:t,headers:{Referer:"https://animetsu.to/"}})).data)?void 0:r.results,n=[];return null==s||s.map(e=>{var t,o,r,s,a,i,p;const _=(null==(t=e.title)?void 0:t.english)||(null==(o=e.title)?void 0:o.romaji)||(null==(r=e.title)?void 0:r.native),l=null==(s=e.id)?void 0:s.toString(),c=(null==(a=e.coverImage)?void 0:a.large)||(null==(i=e.coverImage)?void 0:i.extraLarge)||(null==(p=e.coverImage)?void 0:p.medium);_&&l&&c&&n.push({title:_,link:l,image:c})}),n}catch(e){return[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts; |