mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] limits pages per category for 1337x
This commit is contained in:
@@ -49,7 +49,7 @@ async function scrapeLatestTorrentsForCategory(category, page = 1) {
|
|||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
})
|
})
|
||||||
.then(torrents => Promise.all(torrents.map(torrent => limiter.schedule(() => processTorrentRecord(torrent)))))
|
.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)
|
? scrapeLatestTorrentsForCategory(category, page + 1)
|
||||||
: Promise.resolve());
|
: Promise.resolve());
|
||||||
|
|
||||||
@@ -94,4 +94,14 @@ function typeMapping() {
|
|||||||
return mapping;
|
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 };
|
module.exports = { scrape, updateSeeders, NAME };
|
||||||
Reference in New Issue
Block a user