Skip to content

Commit

Permalink
Fix AsuraScans: getting pages (#6314)
Browse files Browse the repository at this point in the history
First try to gather ts_run data, otherwise fallback to mother method.
  • Loading branch information
MikeZeDev authored and Sheepux committed Jan 2, 2024
1 parent 185ced0 commit 0281ef1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/web/mjs/connectors/AsuraScans.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class AsuraScans extends WordPressMangastream {
label: 'URL',
description: `This website change domains regularly.\nThis is the default URL which can also be manually set by the user.`,
input: 'text',
value: 'https://asura.nacm.xyz'
value: 'https://asuratoon.com'
}
};
}
Expand All @@ -38,7 +38,22 @@ export default class AsuraScans extends WordPressMangastream {
/2021\/03\/20-ending-page-\.jpg/i,
/ENDING-PAGE/i
];
const images = await super._getPages(chapter);

let images = [];

try {
const uri = new URL(chapter.id, this.url);
let request = new Request(uri, this.requestOptions);
let data = await fetch(request);
data = await data.text();

let tsrundata = data.match(/"sources":(\[[^;]+\]}\])/m)[1];
const ts_reader = JSON.parse(tsrundata);
images = ts_reader.shift().images;
} catch(error) {
images = await super._getPages(chapter); //fallback with corrected queryPages
}

return images.filter(link => !excludes.some(rgx => rgx.test(link)));
}
}

0 comments on commit 0281ef1

Please sign in to comment.