Skip to content

Commit

Permalink
Tapas : paginated chapters (#7222)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeZeDev authored Jul 27, 2024
1 parent 5b26291 commit fa918fe
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit fa918fe

Please sign in to comment.