Files
vega-providers/dist/animetsu/stream.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,a)=>{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:!(a=__getOwnPropDesc(t,s))||a.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,r)=>new Promise((a,s)=>{var o=e=>{try{u(r.next(e))}catch(e){s(e)}},n=e=>{try{u(r.throw(e))}catch(e){s(e)}},u=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,n);u((r=r.apply(e,t)).next())}),stream_exports={};__export(stream_exports,{getStream:()=>getStream});var getStream=__name(function(e){return __async(this,arguments,function*({link:e,providerContext:t}){try{const{axios:r}=t,a="https://backend.animetsu.to",[s,o]=e.split(":");if(!s||!o)throw new Error("Invalid link format");const n=["pahe","zoro"],u=[];return yield Promise.all(n.map(e=>__async(null,null,function*(){try{const t=`${a}/api/anime/tiddies?server=${e}&id=${s}&num=${o}&subType=sub`,n=yield r.get(t,{headers:{Referer:"https://animetsu.to/"}});if(n.data&&n.data.sources){const t=[];n.data.sources.forEach(r=>{u.push({server:e+`: ${r.quality}`,link:`https://m3u8.8man.workers.dev?url=${r.url}`,type:"m3u8",quality:r.quality,headers:{referer:"https://animetsu.to/"},subtitles:t.length>0?t:[]})})}}catch(e){}}))),yield Promise.all(n.map(e=>__async(null,null,function*(){try{const t=`${a}/api/anime/tiddies?server=${e}&id=${s}&num=${o}&subType=dub`,n=yield r.get(t,{headers:{referer:"https://animetsu.to/"}});if(n.data&&n.data.sources){const t=[];n.data.sources.forEach(r=>{u.push({server:`${e} (Dub) : ${r.quality}`,link:`https://m3u8.8man.workers.dev?url=${r.url}`,type:"m3u8",quality:r.quality,headers:{referer:"https://animetsu.to/"},subtitles:t.length>0?t:[]})})}}catch(e){}}))),u}catch(e){return[]}})},"getStream");exports.getStream=getStream;