mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Update ashi/ashi.js
This commit is contained in:
parent
f414bb9acf
commit
3d7f39db6c
1 changed files with 24 additions and 32 deletions
56
ashi/ashi.js
56
ashi/ashi.js
|
|
@ -329,16 +329,6 @@ async function extractDetails(url) {
|
|||
}
|
||||
|
||||
async function extractEpisodes(url) {
|
||||
const sendEpisodes = async (endpoint, episodeData) => {
|
||||
const promises = episodeData.map(item =>
|
||||
fetchv2(`${endpoint}=${encodeURIComponent(item.data)}`)
|
||||
.then(res => res.json())
|
||||
.then(json => ({ name: item.name, data: json.result }))
|
||||
.catch(err => ({ name: item.name, error: err.toString() }))
|
||||
);
|
||||
return Promise.all(promises);
|
||||
};
|
||||
|
||||
try {
|
||||
if (url.startsWith("Animekai:")) {
|
||||
const actualUrl = url.replace("Animekai:", "").trim();
|
||||
|
|
@ -357,18 +347,9 @@ async function extractEpisodes(url) {
|
|||
const episodeRegex = /<a[^>]+num="([^"]+)"[^>]+token="([^"]+)"[^>]*>/g;
|
||||
const episodeMatches = [...cleanedHtml.matchAll(episodeRegex)];
|
||||
|
||||
const recentEpisodeMatches = episodeMatches.slice(-50);
|
||||
|
||||
const episodeData = recentEpisodeMatches.map(([_, episodeNum, episodeToken]) => ({
|
||||
name: `Episode ${episodeNum}`,
|
||||
data: episodeToken
|
||||
}));
|
||||
|
||||
const batchResults = await sendEpisodes("https://enc-dec.app/api/enc-kai?text", episodeData);
|
||||
|
||||
const episodes = batchResults.map((result, index) => ({
|
||||
number: parseInt(recentEpisodeMatches[index][1], 10),
|
||||
href: `Animekai:https://animekai.to/ajax/links/list?token=${recentEpisodeMatches[index][2]}&_=${result.data}`
|
||||
const episodes = episodeMatches.map(([_, episodeNum, episodeToken]) => ({
|
||||
number: parseInt(episodeNum, 10),
|
||||
href: `Animekai:https://animekai.to/ajax/links/list?token=${episodeToken}&_=ENCRYPT_ME`
|
||||
}));
|
||||
|
||||
return JSON.stringify(episodes);
|
||||
|
|
@ -388,16 +369,9 @@ async function extractEpisodes(url) {
|
|||
const episodeRegex = /<a[^>]+eid="([^"]+)"[^>]+num="([^"]+)"[^>]*>/g;
|
||||
const episodeMatches = [...cleanedHtml.matchAll(episodeRegex)];
|
||||
|
||||
const episodeData = episodeMatches.map(([_, episodeToken, episodeNum]) => ({
|
||||
name: `Episode ${episodeNum}`,
|
||||
data: episodeToken
|
||||
}));
|
||||
|
||||
const batchResults = await sendEpisodes("https://enc-dec.app/api/enc-movies-flix?text", episodeData);
|
||||
|
||||
const episodes = batchResults.map((result, index) => ({
|
||||
number: parseInt(episodeMatches[index][2], 10),
|
||||
href: `https://1movies.bz/ajax/links/list?eid=${episodeMatches[index][1]}&_=${result.data}`
|
||||
const episodes = episodeMatches.map(([_, episodeToken, episodeNum]) => ({
|
||||
number: parseInt(episodeNum, 10),
|
||||
href: `https://1movies.bz/ajax/links/list?eid=${episodeToken}&_=ENCRYPT_ME`
|
||||
}));
|
||||
|
||||
return JSON.stringify(episodes);
|
||||
|
|
@ -424,6 +398,15 @@ async function extractStreamUrl(url) {
|
|||
|
||||
if (source === "Animekai") {
|
||||
try {
|
||||
const tokenMatch = actualUrl.match(/token=([^&]+)/);
|
||||
if (tokenMatch && tokenMatch[1]) {
|
||||
const rawToken = tokenMatch[1];
|
||||
const encryptResponse = await fetchv2(`https://enc-dec.app/api/enc-kai?text=${encodeURIComponent(rawToken)}`);
|
||||
const encryptData = await encryptResponse.json();
|
||||
const encryptedToken = encryptData.result;
|
||||
actualUrl = actualUrl.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
||||
}
|
||||
|
||||
const response = await fetchv2(actualUrl);
|
||||
const text = await response.text();
|
||||
const cleanedHtml = cleanJsonHtml(text);
|
||||
|
|
@ -582,6 +565,15 @@ async function extractStreamUrl(url) {
|
|||
}
|
||||
} else if (source === "1Movies") {
|
||||
try {
|
||||
const eidMatch = actualUrl.match(/eid=([^&]+)/);
|
||||
if (eidMatch && eidMatch[1]) {
|
||||
const rawEpisodeToken = eidMatch[1];
|
||||
const encryptResponse = await fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${rawEpisodeToken}`);
|
||||
const encryptData = await encryptResponse.json();
|
||||
const encryptedToken = encryptData.result;
|
||||
actualUrl = actualUrl.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
||||
}
|
||||
|
||||
const response = await fetchv2(actualUrl);
|
||||
const responseData = await response.json();
|
||||
const cleanedHtml = cleanJsonHtml(responseData.result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue