mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-03-11 21:26:53 +00:00
[scraper] limits pages per category for 1337x
This commit is contained in:
parent
9123c1ffd8
commit
9b1982abfe
1 changed files with 11 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ async function scrapeLatestTorrentsForCategory(category, page = 1) {
|
|||
return Promise.resolve([]);
|
||||
})
|
||||
.then(torrents => Promise.all(torrents.map(torrent => limiter.schedule(() => processTorrentRecord(torrent)))))
|
||||
.then(resolved => resolved.length > 0 && page < UNTIL_PAGE
|
||||
.then(resolved => resolved.length > 0 && page < untilPage(category)
|
||||
? scrapeLatestTorrentsForCategory(category, page + 1)
|
||||
: Promise.resolve());
|
||||
|
||||
|
|
@ -94,4 +94,14 @@ function typeMapping() {
|
|||
return mapping;
|
||||
}
|
||||
|
||||
function untilPage(category) {
|
||||
if (leetx.Categories.ANIME === category) {
|
||||
return 5;
|
||||
}
|
||||
if (leetx.Categories.DOCUMENTARIES === category) {
|
||||
return 1;
|
||||
}
|
||||
return UNTIL_PAGE;
|
||||
}
|
||||
|
||||
module.exports = { scrape, updateSeeders, NAME };
|
||||
Loading…
Reference in a new issue