mirror of
https://git.luna-app.eu/50n50/sources
synced 2026-01-12 01:18:11 +01:00
Update animepahe/animepahe.js
This commit is contained in:
parent
c76c6ccfb2
commit
e2ef7a93ec
1 changed files with 22 additions and 9 deletions
|
|
@ -75,15 +75,28 @@ async function extractEpisodes(url) {
|
|||
const lastPage = data1.last_page;
|
||||
if (lastPage > 1) {
|
||||
for (let p = 2; p <= lastPage; p++) {
|
||||
const apiUrl = `https://animepahe.si/api?m=release&id=${id}&sort=episode_asc&page=${p}`;
|
||||
const response = await ddosInterceptor.fetchWithBypass(apiUrl);
|
||||
const dataText = await response.text();
|
||||
const data = JSON.parse(dataText);
|
||||
for (const item of data.data) {
|
||||
results.push({
|
||||
href: `https://animepahe.si/play/${id}/${item.session}`,
|
||||
number: item.episode
|
||||
});
|
||||
let pageData = null;
|
||||
let retries = 0;
|
||||
while (!pageData && retries < 3) {
|
||||
try {
|
||||
const apiUrl = `https://animepahe.si/api?m=release&id=${id}&sort=episode_asc&page=${p}`;
|
||||
const response = await ddosInterceptor.fetchWithBypass(apiUrl);
|
||||
const dataText = await response.text();
|
||||
pageData = JSON.parse(dataText);
|
||||
} catch (pageErr) {
|
||||
retries++;
|
||||
if (retries < 3) {
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pageData) {
|
||||
for (const item of pageData.data) {
|
||||
results.push({
|
||||
href: `https://animepahe.si/play/${id}/${item.session}`,
|
||||
number: item.episode
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue