Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tapas : paginated chapters #7222

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/web/mjs/connectors/Tapas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ export default class Tapas extends Connector {
}

async _getChapters(manga) {
let request = new Request(new URL(`${this.url}/series/${manga.id}/episodes?max_limit=9999`), this.requestOptions);
let response = await this.fetchJSON(request);
const chapterList = [];
for(let page = 1, run = true; run; page++) {
const chapters = await this._getChaptersFromPage(manga, page);
chapters.length > 0 ? chapterList.push(...chapters) : run = false;
}
return chapterList;
}

async _getChaptersFromPage(manga, page) {
const request = new Request(new URL(`${this.url}/series/${manga.id}/episodes?page=${page}`), this.requestOptions);
const response = await this.fetchJSON(request);

return response.data.episodes.map(element => {
return {
Expand Down
Loading