[scraper] re-enables tpb api seeders
This commit is contained in:
@@ -117,7 +117,7 @@ function toTorrent(result) {
|
|||||||
name: escapeHTML(result.name),
|
name: escapeHTML(result.name),
|
||||||
infoHash: result.info_hash.toLowerCase(),
|
infoHash: result.info_hash.toLowerCase(),
|
||||||
size: parseInt(result.size),
|
size: parseInt(result.size),
|
||||||
// seeders: parseInt(result.seeders),
|
seeders: parseInt(result.seeders),
|
||||||
leechers: parseInt(result.leechers),
|
leechers: parseInt(result.leechers),
|
||||||
subcategory: parseInt(result.category),
|
subcategory: parseInt(result.category),
|
||||||
uploadDate: new Date(result.added * 1000),
|
uploadDate: new Date(result.added * 1000),
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ const thepiratebay = require('./thepiratebay_api.js');
|
|||||||
const { Type } = require('../../lib/types');
|
const { Type } = require('../../lib/types');
|
||||||
const repository = require('../../lib/repository');
|
const repository = require('../../lib/repository');
|
||||||
const Promises = require('../../lib/promises');
|
const Promises = require('../../lib/promises');
|
||||||
const { updateCurrentSeeders } = require('../../lib/torrent');
|
|
||||||
const { createTorrentEntry, checkAndUpdateTorrent } = require('../../lib/torrentEntries');
|
const { createTorrentEntry, checkAndUpdateTorrent } = require('../../lib/torrentEntries');
|
||||||
|
|
||||||
const NAME = 'ThePirateBay';
|
const NAME = 'ThePirateBay';
|
||||||
const UNTIL_PAGE = 5;
|
const UNTIL_PAGE = 5;
|
||||||
|
|
||||||
const limiter = new Bottleneck({ maxConcurrent: 5 });
|
const limiter = new Bottleneck({ maxConcurrent: 10 });
|
||||||
|
|
||||||
const allowedCategories = [
|
const allowedCategories = [
|
||||||
thepiratebay.Categories.VIDEO.MOVIES,
|
thepiratebay.Categories.VIDEO.MOVIES,
|
||||||
@@ -38,8 +37,7 @@ async function scrape() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateSeeders(torrent) {
|
async function updateSeeders(torrent) {
|
||||||
// return limiter.schedule(() => thepiratebay.torrent(torrent.torrentId));
|
return limiter.schedule(() => thepiratebay.torrent(torrent.torrentId));
|
||||||
return Promise.resolve([]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function scrapeLatestTorrents() {
|
async function scrapeLatestTorrents() {
|
||||||
@@ -68,9 +66,6 @@ async function processTorrentRecord(record) {
|
|||||||
if (!record || !allowedCategories.includes(record.subcategory)) {
|
if (!record || !allowedCategories.includes(record.subcategory)) {
|
||||||
return Promise.resolve('Invalid torrent record');
|
return Promise.resolve('Invalid torrent record');
|
||||||
}
|
}
|
||||||
if (record.seeders === null || record.seeders === undefined) {
|
|
||||||
await updateCurrentSeeders(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
const torrent = {
|
const torrent = {
|
||||||
infoHash: record.infoHash,
|
infoHash: record.infoHash,
|
||||||
|
|||||||
Reference in New Issue
Block a user