push
This commit is contained in:
1 parent
bcf05e8063
commit
f37985b4c8
109 files changed
+22810
-6143
No files matched your search
+625
-1
@@ -1 +1,625 @@
|
||||
var _0x557dba=_0x11a3;(function(_0x4c1790,_0x5872e1){var _0x197a18={_0x4f7961:0x20d,_0x21c64b:0x20c,_0x5a8745:0x21a},_0x1cfb1f=_0x11a3,_0x18776a=_0x4c1790();while(!![]){try{var _0x1aacd2=-parseInt(_0x1cfb1f(_0x197a18._0x4f7961))/0x1+parseInt(_0x1cfb1f(_0x197a18._0x21c64b))/0x2+-parseInt(_0x1cfb1f(0x200))/0x3+parseInt(_0x1cfb1f(0x225))/0x4*(parseInt(_0x1cfb1f(_0x197a18._0x5a8745))/0x5)+-parseInt(_0x1cfb1f(0x1f5))/0x6+-parseInt(_0x1cfb1f(0x221))/0x7*(-parseInt(_0x1cfb1f(0x216))/0x8)+parseInt(_0x1cfb1f(0x219))/0x9;if(_0x1aacd2===_0x5872e1)break;else _0x18776a['push'](_0x18776a['shift']());}catch(_0x4b34ca){_0x18776a['push'](_0x18776a['shift']());}}}(_0xa7e9,0x8c273));var TMDB_KEY=_0x557dba(0x21e),BASE='https://animesalt.link',CDN=_0x557dba(0x214),UA=_0x557dba(0x226);function getInvertedSortTag(_0xe5663d,_0x1e3e19){var _0x3c7972={_0x1c36ad:0x202,_0xc87f6a:0x210},_0x51811b=_0x557dba;if(!_0x1e3e19)_0x1e3e19=0xf423f;var _0x39e711=Math['max'](0x0,parseInt(_0xe5663d,0xa)||0x0),_0x217f5a=Math[_0x51811b(_0x3c7972._0x1c36ad)](0x0,_0x1e3e19-_0x39e711),_0x5c2b65=_0x217f5a[_0x51811b(0x1f3)](0x2);while(_0x5c2b65['length']<0x14){_0x5c2b65='0'+_0x5c2b65;}return _0x5c2b65[_0x51811b(_0x3c7972._0xc87f6a)]('')['map'](function(_0x1f86b8){return _0x1f86b8==='1'?'\ufeff':'';})['join']('');}function getResolutionEmoji(_0x4a47bf){var _0x3387d9={_0x2ca470:0x208,_0x446cad:0x1f7,_0x5e41db:0x21c,_0x3067c5:0x208,_0x28b51a:0x21f,_0x1613bf:0x231},_0x5db03d=_0x557dba,_0x32a132=String(_0x4a47bf||'')['toLowerCase']();if(_0x32a132[_0x5db03d(_0x3387d9._0x2ca470)](_0x5db03d(0x20e))||_0x32a132['includes']('4k')||_0x32a132[_0x5db03d(_0x3387d9._0x2ca470)]('uhd'))return _0x5db03d(0x22a);if(_0x32a132[_0x5db03d(0x208)](_0x5db03d(0x232))||_0x32a132['includes'](_0x5db03d(0x22f)))return _0x5db03d(_0x3387d9._0x446cad);if(_0x32a132['includes'](_0x5db03d(_0x3387d9._0x5e41db))||_0x32a132[_0x5db03d(_0x3387d9._0x3067c5)]('hd'))return'💎\x20720p';if(_0x32a132['includes'](_0x5db03d(_0x3387d9._0x28b51a))||_0x32a132[_0x5db03d(0x208)]('sd'))return _0x5db03d(_0x3387d9._0x1613bf);return'📺\x20'+(_0x4a47bf||'1080p');}function qualityRank(_0x41fc5e){var _0x4aeea4=_0x557dba;if(/2160p|4k/i['test'](_0x41fc5e))return 0x4;if(/1080p/i[_0x4aeea4(0x21d)](_0x41fc5e))return 0x3;if(/720p/i['test'](_0x41fc5e))return 0x2;if(/480p/i['test'](_0x41fc5e))return 0x1;return 0x0;}function httpGet(_0x420b31,_0x57deb1){var _0xb8e8ef={_0xd72923:0x20b},_0x28356a=_0x557dba;return fetch(_0x420b31,{'headers':Object['assign']({'User-Agent':UA},_0x57deb1||{})})[_0x28356a(_0xb8e8ef._0xd72923)](function(_0x534919){var _0x513635=_0x28356a;if(!_0x534919['ok'])throw new Error('HTTP\x20'+_0x534919[_0x513635(0x1f6)]);return _0x534919[_0x513635(0x1fb)]();});}function _0x11a3(_0x479722,_0x33ee57){_0x479722=_0x479722-0x1ef;var _0xa7e9a4=_0xa7e9();var _0x11a3f4=_0xa7e9a4[_0x479722];if(_0x11a3['ZGiWMW']===undefined){var _0x3ca26c=function(_0x1db348){var _0x16b95f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xe5663d='',_0x1e3e19='';for(var _0x39e711=0x0,_0x217f5a,_0x5c2b65,_0x1f86b8=0x0;_0x5c2b65=_0x1db348['charAt'](_0x1f86b8++);~_0x5c2b65&&(_0x217f5a=_0x39e711%0x4?_0x217f5a*0x40+_0x5c2b65:_0x5c2b65,_0x39e711++%0x4)?_0xe5663d+=String['fromCharCode'](0xff&_0x217f5a>>(-0x2*_0x39e711&0x6)):0x0){_0x5c2b65=_0x16b95f['indexOf'](_0x5c2b65);}for(var _0x4a47bf=0x0,_0x32a132=_0xe5663d['length'];_0x4a47bf<_0x32a132;_0x4a47bf++){_0x1e3e19+='%'+('00'+_0xe5663d['charCodeAt'](_0x4a47bf)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1e3e19);};_0x11a3['QUsIIC']=_0x3ca26c,_0x11a3['hkNbvk']={},_0x11a3['ZGiWMW']=!![];}var _0x22daf0=_0xa7e9a4[0x0],_0x3b9c80=_0x479722+_0x22daf0,_0x1e71b2=_0x11a3['hkNbvk'][_0x3b9c80];return!_0x1e71b2?(_0x11a3f4=_0x11a3['QUsIIC'](_0x11a3f4),_0x11a3['hkNbvk'][_0x3b9c80]=_0x11a3f4):_0x11a3f4=_0x1e71b2,_0x11a3f4;}function httpPost(_0x30217a,_0x2a874f,_0x5d2c7b){var _0x4ba3ab={_0x8622c8:0x20b},_0x8b1ada=_0x557dba;return fetch(_0x30217a,{'method':'POST','headers':Object['assign']({'User-Agent':UA,'Content-Type':'application/x-www-form-urlencoded'},_0x5d2c7b||{}),'body':_0x2a874f})[_0x8b1ada(_0x4ba3ab._0x8622c8)](function(_0x248002){var _0x5d3ded=_0x8b1ada;if(!_0x248002['ok'])throw new Error('HTTP\x20'+_0x248002[_0x5d3ded(0x1f6)]);return _0x248002['json']();});}function cleanTitle(_0x5b441f){return _0x5b441f['toLowerCase']()['replace'](/[^a-z0-9\s]/g,'')['replace'](/\s+/g,'\x20')['trim']();}function searchSite(_0x2a21aa,_0x31db93,_0x3faa33){var _0x4a25ab={_0x6d2555:0x203,_0x504a4d:0x227,_0x570a08:0x1f0,_0x2a521d:0x20f,_0x5715b1:0x1fd,_0x4afc3c:0x211,_0x417df0:0x228,_0x106144:0x1f0},_0xb8ef2e={_0x153a14:0x22b},_0x438d59={_0x2459ae:0x1f9},_0x461a90=BASE+'/?s='+encodeURIComponent(_0x2a21aa);return httpGet(_0x461a90,{'Referer':BASE+'/'})['then'](function(_0x41a043){var _0x50788c=_0x11a3,_0x5bcabd=[],_0x32361a=_0x41a043[_0x50788c(_0x4a25ab._0x6d2555)](/id="movies-a"([\s\S]*?)(?=<footer|id="footer|class="footer)/m),_0xb286f3=_0x32361a?_0x32361a[0x1]:_0x41a043Line truncated
|
||||
/**
|
||||
* animesalt - Built from src/animesalt/
|
||||
* Generated: 2026-09-22T20:41:44.444Z
|
||||
*/
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __defProps = Object.defineProperties;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __spreadValues = (a, b) => {
|
||||
for (var prop in b || (b = {}))
|
||||
if (__hasOwnProp.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
if (__getOwnPropSymbols)
|
||||
for (var prop of __getOwnPropSymbols(b)) {
|
||||
if (__propIsEnum.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __async = (__this, __arguments, generator) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
var fulfilled = (value) => {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
var rejected = (value) => {
|
||||
try {
|
||||
step(generator.throw(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||||
step((generator = generator.apply(__this, __arguments)).next());
|
||||
});
|
||||
};
|
||||
|
||||
// src/animesalt/index.js
|
||||
var import_cheerio_without_node_native2 = __toESM(require("cheerio-without-node-native"));
|
||||
|
||||
// src/animesalt/constants.js
|
||||
var MAIN_URL = "https://animesalt.cx";
|
||||
var TMDB_API_KEY = "1865f43a0549ca50d341dd9ab8b29f49";
|
||||
var TMDB_BASE_URL = "https://api.themoviedb.org/3";
|
||||
var USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
|
||||
var HEADERS = {
|
||||
"User-Agent": USER_AGENT,
|
||||
"Accept": "*/*",
|
||||
"Accept-Language": "en-US,en;q=0.5"
|
||||
};
|
||||
|
||||
// src/animesalt/utils.js
|
||||
function fetchTmdbDetails(tmdbId, mediaType) {
|
||||
return __async(this, null, function* () {
|
||||
var _a;
|
||||
const endpoint = mediaType === "movie" ? "movie" : "tv";
|
||||
const url = `${TMDB_BASE_URL}/${endpoint}/${tmdbId}?api_key=${TMDB_API_KEY}&append_to_response=external_ids`;
|
||||
try {
|
||||
const res = yield fetch(url, { headers: HEADERS });
|
||||
if (!res.ok)
|
||||
return null;
|
||||
const data = yield res.json();
|
||||
return {
|
||||
title: mediaType === "movie" ? data.title || data.original_title : data.name || data.original_name,
|
||||
year: parseInt((data.release_date || data.first_air_date || "").substring(0, 4)) || null,
|
||||
imdbId: ((_a = data.external_ids) == null ? void 0 : _a.imdb_id) || null
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
function cleanTitle(str) {
|
||||
return (str || "").toLowerCase().replace(/[^a-z0-9\s]/g, "").replace(/\s+/g, " ").trim();
|
||||
}
|
||||
function titleSimilarity(a, b) {
|
||||
const cleanA = cleanTitle(a);
|
||||
const cleanB = cleanTitle(b);
|
||||
if (!cleanA || !cleanB)
|
||||
return 0;
|
||||
if (cleanA === cleanB)
|
||||
return 1;
|
||||
if (cleanA.includes(cleanB) || cleanB.includes(cleanA))
|
||||
return 0.8;
|
||||
const wordsA = new Set(cleanA.split(" "));
|
||||
const wordsB = new Set(cleanB.split(" "));
|
||||
let intersection = 0;
|
||||
for (const w of wordsA) {
|
||||
if (wordsB.has(w))
|
||||
intersection++;
|
||||
}
|
||||
return intersection * 2 / (wordsA.size + wordsB.size);
|
||||
}
|
||||
function unpack(code) {
|
||||
try {
|
||||
const match = code.match(/}\((['"])([\s\S]*?)\1,\s*(\d+),\s*(\d+),\s*(['"])([\s\S]*?)\5\.split\((['"])\|\7\)/);
|
||||
if (match) {
|
||||
let [_, quote1, p, a, c, quote2, kStr] = match;
|
||||
p = p.replace(/\\'/g, "'").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
||||
const radix = parseInt(a);
|
||||
let count = parseInt(c);
|
||||
const k = kStr.split("|");
|
||||
const e = (c2) => (c2 < radix ? "" : e(parseInt(c2 / radix))) + ((c2 = c2 % radix) > 35 ? String.fromCharCode(c2 + 29) : c2.toString(36));
|
||||
const d = {};
|
||||
while (count--)
|
||||
d[e(count)] = k[count] || e(count);
|
||||
return p.replace(/\b\w+\b/g, (w) => d[w]);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
return code;
|
||||
}
|
||||
function isRealStreamUrl(url) {
|
||||
if (!url || typeof url !== "string")
|
||||
return false;
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://"))
|
||||
return false;
|
||||
const lowercase = url.toLowerCase();
|
||||
if (lowercase.includes("/embed/") || lowercase.includes("/embed-") || lowercase.includes("/e/") || lowercase.includes("/play.php") || lowercase.includes("/player.php") || lowercase.includes("abyssplayer.com") || lowercase.includes("short.icu") || lowercase.includes("cloudy.upns.one") || lowercase.includes("vidcloud.upns.ink") || lowercase.includes("filesforever.link") || lowercase.includes("strmup.to") || lowercase.includes("emturbovid.com") || lowercase.includes("animedekho.app") || lowercase.includes("animesalt.cx") || lowercase.includes("youtube.com") || lowercase.includes("youtu.be") || lowercase.includes("vimeo.com") || lowercase.includes(".html") || lowercase.includes(".htm") || lowercase.includes(".php") || lowercase.includes("#")) {
|
||||
return false;
|
||||
}
|
||||
const isHls = lowercase.includes(".m3u8");
|
||||
const isMp4 = lowercase.includes(".mp4") || lowercase.includes("/sora/") || lowercase.includes("/stream/");
|
||||
return isHls || isMp4 || lowercase.includes(".mkv") || lowercase.includes(".mpd");
|
||||
}
|
||||
function isPlayableStream(stream) {
|
||||
return __async(this, null, function* () {
|
||||
if (!isRealStreamUrl(stream == null ? void 0 : stream.url))
|
||||
return false;
|
||||
try {
|
||||
const headers = __spreadProps(__spreadValues({
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
||||
}, stream.headers || {}), {
|
||||
"Range": "bytes=0-10"
|
||||
});
|
||||
const res = yield fetch(stream.url, {
|
||||
headers,
|
||||
signal: AbortSignal.timeout(3e3)
|
||||
});
|
||||
if (!res.ok && res.status !== 206)
|
||||
return false;
|
||||
const contentType = res.headers.get("content-type") || "";
|
||||
if (contentType.includes("text/html"))
|
||||
return false;
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// src/animesalt/extractors.js
|
||||
var import_cheerio_without_node_native = __toESM(require("cheerio-without-node-native"));
|
||||
var import_crypto_js = __toESM(require("crypto-js"));
|
||||
function extractAwsStream(url) {
|
||||
return __async(this, null, function* () {
|
||||
try {
|
||||
const hash = url.split("/").filter(Boolean).pop();
|
||||
if (!hash)
|
||||
return null;
|
||||
const origin = new URL(url).origin;
|
||||
const res = yield fetch(url, { headers: HEADERS });
|
||||
if (!res.ok)
|
||||
return null;
|
||||
const html = yield res.text();
|
||||
const postUrl = `${origin}/player/index.php?data=${hash}&do=getVideo`;
|
||||
const postRes = yield fetch(postUrl, {
|
||||
method: "POST",
|
||||
headers: __spreadProps(__spreadValues({}, HEADERS), {
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
"Origin": origin,
|
||||
"Referer": url,
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}),
|
||||
body: `hash=${encodeURIComponent(hash)}&r=${encodeURIComponent(origin)}`
|
||||
});
|
||||
if (!postRes.ok)
|
||||
return null;
|
||||
const json = yield postRes.json();
|
||||
const m3u8 = json == null ? void 0 : json.videoSource;
|
||||
if (!m3u8)
|
||||
return null;
|
||||
let subtitle = null;
|
||||
const packedMatch = html.match(/eval\(function\(p,a,c,k,e,d\)[\s\S]*?\.split\(['"]\|['"]\)\)/);
|
||||
if (packedMatch) {
|
||||
const unpacked = unpack(packedMatch[0]);
|
||||
const subMatch = unpacked.match(/"kind":\s*"captions"\s*,\s*"file":\s*"(https?:\/\/[^"]+)"/);
|
||||
if (subMatch) {
|
||||
subtitle = subMatch[1].replace(/\\/g, "");
|
||||
}
|
||||
}
|
||||
return {
|
||||
url: m3u8,
|
||||
headers: {
|
||||
"Referer": `${origin}/`,
|
||||
"Origin": origin,
|
||||
"User-Agent": HEADERS["User-Agent"]
|
||||
},
|
||||
subtitles: subtitle ? [{ lang: "English", url: subtitle }] : []
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
function extractAbyss(url, langName = "Default") {
|
||||
return __async(this, null, function* () {
|
||||
var _a;
|
||||
try {
|
||||
const cleanUrl = url.replace("https://short.icu", "https://abyssplayer.com");
|
||||
const reqHeaders = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
|
||||
"Origin": "https://playhydrax.com",
|
||||
"Referer": "https://playhydrax.com/"
|
||||
};
|
||||
const res = yield fetch(cleanUrl, { headers: reqHeaders });
|
||||
if (!res.ok)
|
||||
return [];
|
||||
const html = yield res.text();
|
||||
const match = html.match(/const\s+datas\s*=\s*"([^"]*)"/);
|
||||
if (!match || !match[1])
|
||||
return [];
|
||||
const decRes = yield fetch("https://enc-dec.app/api/dec-abyss", {
|
||||
method: "POST",
|
||||
headers: __spreadProps(__spreadValues({}, reqHeaders), {
|
||||
"Content-Type": "application/json"
|
||||
}),
|
||||
body: JSON.stringify({ text: match[1] })
|
||||
});
|
||||
if (!decRes.ok)
|
||||
return [];
|
||||
const decData = yield decRes.json();
|
||||
const sources = ((_a = decData == null ? void 0 : decData.result) == null ? void 0 : _a.sources) || [];
|
||||
return sources.filter((s) => s && s.url && s.status).map((s) => {
|
||||
const codec = (s.codec || "MP4").toUpperCase();
|
||||
const quality = s.type || "720p";
|
||||
return {
|
||||
name: `AnimeSalt [${langName}] (${codec} ${quality})`,
|
||||
url: s.url,
|
||||
quality,
|
||||
headers: {
|
||||
"Referer": "https://playhydrax.com/",
|
||||
"Origin": "https://playhydrax.com",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
||||
},
|
||||
type: s.url.includes(".m3u8") ? "m3u8" : "mp4"
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
function extractMultiLang(dataParam) {
|
||||
return __async(this, null, function* () {
|
||||
try {
|
||||
let decodedStr = "";
|
||||
if (typeof atob === "function") {
|
||||
decodedStr = atob(dataParam);
|
||||
} else {
|
||||
decodedStr = Buffer.from(dataParam, "base64").toString("utf-8");
|
||||
}
|
||||
const list = JSON.parse(decodedStr);
|
||||
if (!Array.isArray(list))
|
||||
return [];
|
||||
const streamPromises = list.map((item) => {
|
||||
const lang = item.language || "Default";
|
||||
const link = item.link;
|
||||
if (!link)
|
||||
return Promise.resolve([]);
|
||||
return extractAbyss(link, lang);
|
||||
});
|
||||
const nested = yield Promise.all(streamPromises);
|
||||
return nested.flat();
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
function extractMegaPlay(url) {
|
||||
return __async(this, null, function* () {
|
||||
var _a;
|
||||
try {
|
||||
let streamPageUrl = url;
|
||||
if (!url.includes("/stream/s-")) {
|
||||
const pageRes = yield fetch(url, { headers: HEADERS });
|
||||
if (!pageRes.ok)
|
||||
return [];
|
||||
const html = yield pageRes.text();
|
||||
const $ = import_cheerio_without_node_native.default.load(html);
|
||||
const embedSrc = $("iframe.s5-embed").attr("src");
|
||||
if (!embedSrc)
|
||||
return [];
|
||||
streamPageUrl = embedSrc;
|
||||
}
|
||||
const idMatch = streamPageUrl.match(/\/stream\/s-\d+\/(\d+)\//);
|
||||
if (!idMatch || !idMatch[1])
|
||||
return [];
|
||||
const id = idMatch[1];
|
||||
const origin = new URL(streamPageUrl).origin;
|
||||
const apiHeaders = {
|
||||
"Accept": "*/*",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Referer": origin,
|
||||
"User-Agent": HEADERS["User-Agent"]
|
||||
};
|
||||
const apiRes = yield fetch(`${origin}/stream/getSources?id=${id}`, { headers: apiHeaders });
|
||||
if (!apiRes.ok)
|
||||
return [];
|
||||
const resJson = yield apiRes.json();
|
||||
let file = (_a = resJson == null ? void 0 : resJson.sources) == null ? void 0 : _a.file;
|
||||
const enc = resJson == null ? void 0 : resJson.enc;
|
||||
if (!file && enc) {
|
||||
const keyStr = "i?LMTAx0Q6,:}50U";
|
||||
const keyHex = import_crypto_js.default.enc.Utf8.parse(keyStr).toString(import_crypto_js.default.enc.Hex).padEnd(64, "0");
|
||||
const key = import_crypto_js.default.enc.Hex.parse(keyHex);
|
||||
const iv = import_crypto_js.default.enc.Utf8.parse("W0;27ToaUpl_P%'c");
|
||||
const normalized = enc.replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padded = normalized + "=".repeat((4 - normalized.length % 4) % 4);
|
||||
const decrypted = import_crypto_js.default.AES.decrypt(padded, key, {
|
||||
iv,
|
||||
mode: import_crypto_js.default.mode.CBC,
|
||||
padding: import_crypto_js.default.pad.Pkcs7
|
||||
});
|
||||
const decObj = JSON.parse(decrypted.toString(import_crypto_js.default.enc.Utf8));
|
||||
file = decObj == null ? void 0 : decObj.file;
|
||||
}
|
||||
if (!file)
|
||||
return [];
|
||||
const tokenMatch = file.match(/\/([a-f0-9]{32})\/([a-f0-9]{32})\//i);
|
||||
if (tokenMatch && !file.includes("token=")) {
|
||||
const secret = "MpCdnT0k3n!9f2K#xQ7vL5mR8wN1pY4s";
|
||||
const expires = Math.floor(Date.now() / 1e3) + 90;
|
||||
const payload = `${expires}|${tokenMatch[1]}/${tokenMatch[2]}`;
|
||||
const hash = import_crypto_js.default.HmacSHA256(payload, secret);
|
||||
const b64Payload = import_crypto_js.default.enc.Base64.stringify(import_crypto_js.default.enc.Utf8.parse(payload)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
||||
const b64Sig = import_crypto_js.default.enc.Base64.stringify(hash).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
||||
const token = `${b64Payload}.${b64Sig}`;
|
||||
file = `${file}${file.includes("?") ? "&" : "?"}token=${token}`;
|
||||
}
|
||||
const subtitles = ((resJson == null ? void 0 : resJson.tracks) || []).filter((t) => t.file && t.kind !== "thumbnails").map((t) => ({ lang: t.label || "English", url: t.file }));
|
||||
return [{
|
||||
name: "AnimeSalt [MegaPlay] (Auto M3U8)",
|
||||
url: file,
|
||||
quality: "1080p",
|
||||
headers: {
|
||||
"Referer": `${origin}/`,
|
||||
"Origin": origin,
|
||||
"User-Agent": HEADERS["User-Agent"]
|
||||
},
|
||||
subtitles,
|
||||
type: "m3u8"
|
||||
}];
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
function extractStreamWish(url) {
|
||||
return __async(this, null, function* () {
|
||||
try {
|
||||
const embedUrl = url.includes("/e/") ? url : url.replace("/f/", "/e/");
|
||||
const res = yield fetch(embedUrl, { headers: HEADERS });
|
||||
if (!res.ok)
|
||||
return null;
|
||||
const html = yield res.text();
|
||||
const packedMatch = html.match(/eval\(function\(p,a,c,k,e,d\)[\s\S]*?\.split\(['"]\|['"]\)\)/);
|
||||
if (packedMatch) {
|
||||
const unpacked = unpack(packedMatch[0]);
|
||||
const fileMatch = unpacked.match(/file\s*:\s*["'](https?:\/\/[^"'\s]+\.m3u8(?:\?[^"'\s]*)?)["']/);
|
||||
if (fileMatch) {
|
||||
const origin = new URL(embedUrl).origin;
|
||||
return {
|
||||
name: "AnimeSalt [StreamWish] (Auto M3U8)",
|
||||
url: fileMatch[1],
|
||||
quality: "720p",
|
||||
headers: {
|
||||
"Referer": `${origin}/`,
|
||||
"Origin": origin,
|
||||
"User-Agent": HEADERS["User-Agent"]
|
||||
},
|
||||
type: "m3u8"
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
// src/animesalt/index.js
|
||||
function searchAnimeSalt(query) {
|
||||
return __async(this, null, function* () {
|
||||
var _a;
|
||||
try {
|
||||
const body = `action=torofilm_infinite_scroll&page=1&per_page=12&query_type=search&query_args[s]=${encodeURIComponent(query)}`;
|
||||
const res = yield fetch(`${MAIN_URL}/wp-admin/admin-ajax.php`, {
|
||||
method: "POST",
|
||||
headers: __spreadProps(__spreadValues({}, HEADERS), {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Referer": `${MAIN_URL}/`
|
||||
}),
|
||||
body
|
||||
});
|
||||
if (!res.ok)
|
||||
return [];
|
||||
const json = yield res.json();
|
||||
if (!(json == null ? void 0 : json.success) || !((_a = json == null ? void 0 : json.data) == null ? void 0 : _a.content))
|
||||
return [];
|
||||
const $ = import_cheerio_without_node_native2.default.load(json.data.content);
|
||||
const results = [];
|
||||
$("article").each((_, el) => {
|
||||
const title = $(el).find("header h2").text().trim();
|
||||
const href = $(el).find("a").first().attr("href");
|
||||
if (title && href) {
|
||||
results.push({ title, href });
|
||||
}
|
||||
});
|
||||
return results;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
function getStreams(tmdbId, mediaType, seasonNum = 1, episodeNum = 1) {
|
||||
return __async(this, null, function* () {
|
||||
try {
|
||||
const details = yield fetchTmdbDetails(tmdbId, mediaType);
|
||||
if (!details || !details.title)
|
||||
return [];
|
||||
let results = yield searchAnimeSalt(details.title);
|
||||
if (results.length === 0) {
|
||||
const cleaned = cleanTitle(details.title);
|
||||
if (cleaned && cleaned !== details.title.toLowerCase()) {
|
||||
results = yield searchAnimeSalt(cleaned);
|
||||
}
|
||||
}
|
||||
if (results.length === 0)
|
||||
return [];
|
||||
let bestMatch = null;
|
||||
let highestSim = 0;
|
||||
for (const item of results) {
|
||||
const sim = titleSimilarity(details.title, item.title);
|
||||
if (sim > highestSim) {
|
||||
highestSim = sim;
|
||||
bestMatch = item;
|
||||
}
|
||||
}
|
||||
if (!bestMatch || highestSim < 0.2) {
|
||||
bestMatch = results[0];
|
||||
}
|
||||
let targetUrl = bestMatch.href;
|
||||
if (mediaType === "tv") {
|
||||
const seriesRes = yield fetch(bestMatch.href, { headers: HEADERS });
|
||||
if (!seriesRes.ok)
|
||||
return [];
|
||||
const seriesHtml = yield seriesRes.text();
|
||||
const $series = import_cheerio_without_node_native2.default.load(seriesHtml);
|
||||
let seasonBtn = $series(`div.season-buttons a[data-season="${seasonNum}"]`);
|
||||
if (seasonBtn.length === 0) {
|
||||
seasonBtn = $series("div.season-buttons a").first();
|
||||
}
|
||||
const postId = seasonBtn.attr("data-post");
|
||||
const dataSeason = seasonBtn.attr("data-season") || seasonNum;
|
||||
if (postId) {
|
||||
const epRes = yield fetch(`${MAIN_URL}/wp-admin/admin-ajax.php`, {
|
||||
method: "POST",
|
||||
headers: __spreadProps(__spreadValues({}, HEADERS), {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Referer": bestMatch.href
|
||||
}),
|
||||
body: `action=action_select_season&season=${dataSeason}&post=${postId}`
|
||||
});
|
||||
if (epRes.ok) {
|
||||
const epHtml = yield epRes.text();
|
||||
const $ep = import_cheerio_without_node_native2.default.load(epHtml);
|
||||
const epArticles = $ep("li article");
|
||||
let targetEp = null;
|
||||
epArticles.each((idx, el) => {
|
||||
const epText = $ep(el).find("h2.entry-title").text();
|
||||
if (epText.includes(`x${episodeNum}`) || epText.includes(`Episode ${episodeNum}`)) {
|
||||
targetEp = $ep(el).find("a").first().attr("href");
|
||||
}
|
||||
});
|
||||
if (!targetEp && epArticles.length >= episodeNum) {
|
||||
targetEp = $ep(epArticles[episodeNum - 1]).find("a").first().attr("href");
|
||||
}
|
||||
if (targetEp) {
|
||||
targetUrl = targetEp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const pageRes = yield fetch(targetUrl, { headers: HEADERS });
|
||||
if (!pageRes.ok)
|
||||
return [];
|
||||
const pageHtml = yield pageRes.text();
|
||||
const $page = import_cheerio_without_node_native2.default.load(pageHtml);
|
||||
const iframeUrls = /* @__PURE__ */ new Set();
|
||||
$page("iframe").each((_, el) => {
|
||||
const src = $page(el).attr("data-src") || $page(el).attr("src");
|
||||
if (src && !src.startsWith("about:") && !src.startsWith("javascript:")) {
|
||||
const fullUrl = src.startsWith("//") ? `https:${src}` : src.startsWith("http") ? src : `${MAIN_URL}${src}`;
|
||||
iframeUrls.add(fullUrl);
|
||||
}
|
||||
});
|
||||
const streams = [];
|
||||
const promises = [];
|
||||
for (const iframeUrl of iframeUrls) {
|
||||
if (iframeUrl.includes("multi-lang-plyr/player.php")) {
|
||||
const urlObj = new URL(iframeUrl);
|
||||
const dataParam = urlObj.searchParams.get("data");
|
||||
if (dataParam) {
|
||||
promises.push(
|
||||
extractMultiLang(dataParam).then((res) => {
|
||||
if (Array.isArray(res))
|
||||
streams.push(...res);
|
||||
})
|
||||
);
|
||||
}
|
||||
} else if (iframeUrl.includes("as-cdn") || iframeUrl.includes("awstream") || iframeUrl.includes("zephyrflick")) {
|
||||
promises.push(
|
||||
extractAwsStream(iframeUrl).then((res) => {
|
||||
if (res && res.url) {
|
||||
streams.push({
|
||||
name: "AnimeSalt [AWSStream] (Auto M3U8)",
|
||||
url: res.url,
|
||||
quality: "1080p",
|
||||
headers: res.headers,
|
||||
subtitles: res.subtitles,
|
||||
type: "m3u8"
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
} else if (iframeUrl.includes("abyssplayer.com") || iframeUrl.includes("short.icu")) {
|
||||
promises.push(
|
||||
extractAbyss(iframeUrl, "Default").then((res) => {
|
||||
if (Array.isArray(res))
|
||||
streams.push(...res);
|
||||
})
|
||||
);
|
||||
} else if (iframeUrl.includes("megaplay.buzz") || iframeUrl.includes("rapid-cloud.co")) {
|
||||
promises.push(
|
||||
extractMegaPlay(iframeUrl).then((res) => {
|
||||
if (Array.isArray(res))
|
||||
streams.push(...res);
|
||||
})
|
||||
);
|
||||
} else if (iframeUrl.includes("pixdrive") || iframeUrl.includes("ghbrisk") || iframeUrl.includes("streamwish") || iframeUrl.includes("filesim")) {
|
||||
promises.push(
|
||||
extractStreamWish(iframeUrl).then((res) => {
|
||||
if (res)
|
||||
streams.push(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
yield Promise.allSettled(promises);
|
||||
const seenUrls = /* @__PURE__ */ new Set();
|
||||
const candidateStreams = [];
|
||||
for (const s of streams) {
|
||||
if (s && s.url && !seenUrls.has(s.url) && isRealStreamUrl(s.url)) {
|
||||
seenUrls.add(s.url);
|
||||
candidateStreams.push({
|
||||
name: s.name || "AnimeSalt",
|
||||
title: mediaType === "movie" ? details.title : `${details.title} - S${seasonNum}E${episodeNum}`,
|
||||
url: s.url,
|
||||
quality: s.quality || "Auto",
|
||||
headers: s.headers,
|
||||
subtitles: s.subtitles || [],
|
||||
provider: "animesalt",
|
||||
type: s.type || "m3u8"
|
||||
});
|
||||
}
|
||||
}
|
||||
const probeResults = yield Promise.all(
|
||||
candidateStreams.map((s) => __async(this, null, function* () {
|
||||
return { stream: s, playable: yield isPlayableStream(s) };
|
||||
}))
|
||||
);
|
||||
let finalStreams = probeResults.filter((r) => r.playable).map((r) => r.stream);
|
||||
if (finalStreams.length === 0)
|
||||
finalStreams = candidateStreams;
|
||||
const qualityOrder = { "1080p": 4, "720p": 3, "480p": 2, "360p": 1, "Auto": 0 };
|
||||
return finalStreams.sort((a, b) => {
|
||||
var _a, _b;
|
||||
return ((_a = qualityOrder[b.quality]) != null ? _a : 0) - ((_b = qualityOrder[a.quality]) != null ? _b : 0);
|
||||
});
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
module.exports = { getStreams };
|
||||
Reference in new issue
Block a user