Skip to content

Commit

Permalink
ComicWalker: better manga list (#7003)
Browse files Browse the repository at this point in the history
Fixes #7000
  • Loading branch information
MikeZeDev authored May 4, 2024
1 parent cbe0eaf commit 7f0658f
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/web/mjs/connectors/ComicWalker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ export default class ComicWalker extends Connector {
}

async _getMangas() {
const mangasList = [];
const apiCallUrl = new URL(`search/initial`, this.apiURL);
const data = await this.fetchJSON(new Request(apiCallUrl, this.requestOptions));
for (const entry of data) {
mangasList.push(...entry.items.map(manga => {
return {
id: manga.code,
title: manga.title.trim()
};
}));
const mangaList = [];
for (let page = 0, run = true; run; page++) {
const mangas = await this._getMangasFromPage(page);
mangas.length > 0 ? mangaList.push(...mangas) : run = false;
}
return mangasList;
return mangaList;
}

async _getMangasFromPage(page) {
const apiCallUrl = new URL(`search/keywords?keywords=&limit=100&offset=${ page * 100}`, this.apiURL);
const data = await this.fetchJSON(new Request(apiCallUrl, this.requestOptions));
return data.result.map(manga => {
return {
id: manga.code,
title: manga.title.trim()
};
});
}

async _getChapters( manga ) {
Expand Down

0 comments on commit 7f0658f

Please sign in to comment.