mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] adds pagination to new tpb browse api
This commit is contained in:
@@ -93,8 +93,9 @@ function search(keyword, config = {}, retries = 2) {
|
||||
|
||||
function browse(config = {}, retries = 2) {
|
||||
const category = config.category || 0;
|
||||
const page = config.page - 1 || 0;
|
||||
|
||||
return _request(`q.php?q=category:${category}`)
|
||||
return _request(`q.php?q=category:${category}:${page}`)
|
||||
.then(results => results.map((result) => toTorrent(result)))
|
||||
.catch(error => retries ? browse(config, retries - 1) : Promise.reject(error));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ const Promises = require('../../lib/promises');
|
||||
const { createTorrentEntry, getStoredTorrentEntry, updateTorrentSeeders } = require('../../lib/torrentEntries');
|
||||
|
||||
const NAME = 'ThePirateBay';
|
||||
const UNTIL_PAGE = 1;
|
||||
const UNTIL_PAGE = 5;
|
||||
|
||||
const limiter = new Bottleneck({ maxConcurrent: 40 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user