Skip to content

Commit

Permalink
Mangakatana : Add delay for mangalist fetching
Browse files Browse the repository at this point in the history
Fixes #5571
  • Loading branch information
MikeZeDev authored Mar 15, 2023
1 parent fdb5354 commit 683edc8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/web/mjs/connectors/MangaKatana.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ export default class MangaKatana extends Connector {
super.label = 'MangaKatana';
this.tags = [ 'manga', 'english' ];
this.url = 'https://mangakatana.com';

this.queryPages = '#imgs .wrap_img img[data-src]';
this.config = {
throttle: {
label: 'Manga list Throttle [ms]',
description: 'Enter the timespan in [ms] to delay consecutive requests to the website for Manga list fetching',
input: 'numeric',
min: 100,
max: 10000,
value: 1000
}
};
}

async _getMangaFromURI(uri) {
Expand All @@ -27,6 +36,7 @@ export default class MangaKatana extends Connector {
let pageCount = parseInt(data[0].href.match(/\/(\d+)$/)[1]);
for(let page = 1; page <= pageCount; page++) {
let mangas = await this._getMangasFromPage(page);
await this.wait(this.config.throttle.value);
mangaList.push(...mangas);
}
return mangaList;
Expand Down Expand Up @@ -73,4 +83,4 @@ export default class MangaKatana extends Connector {
const data = await Engine.Request.fetchUI(request, script);
return data.map(link => this.createConnectorURI(link));
}
}
}

0 comments on commit 683edc8

Please sign in to comment.