[scraper] updates hs mapping

This commit is contained in:
TheBeastLT
2020-04-08 16:32:39 +02:00
parent ce0e330172
commit 9ea008572d
2 changed files with 6 additions and 5 deletions

View File

@@ -14,6 +14,8 @@ const thepiratebayDumpScraper = require('./scrapers/thepiratebay/thepiratebay_du
const thepiratebayUnofficialDumpScraper = require('./scrapers/thepiratebay/thepiratebay_unofficial_dump_scraper');
const PROVIDERS = [
// require('./scrapers/thepiratebay/thepiratebay_update_size_scraper')
// require('./scrapers/1337x/1337x_dump_scraper')
horribleSubsScraper,
rarbgScraper,
thepiratebayScraper,
@@ -23,8 +25,8 @@ const PROVIDERS = [
// thepiratebayDumpScraper
// thepiratebayUnofficialDumpScraper
];
const SCRAPE_CRON = process.env.SCRAPE_CRON || '0 0 */4 ? * *';
const SEEDERS_CRON = '*/60 * * ? * *';
const SCRAPE_CRON = process.env.SCRAPE_CRON || '0 0 */4 ? * *'; // every 4 hours
const SEEDERS_CRON = '0 */2 * ? * *'; // every 2 minutes
async function scrape() {
return PROVIDERS
@@ -41,7 +43,8 @@ async function updateSeeders() {
return getUpdateSeedersTorrents()
.then(torrents => Promise.all(torrents
.map(torrent => PROVIDERS.find(provider => provider.NAME === torrent.provider)
.updateSeeders(torrent))));
.updateSeeders(torrent))))
.then(() => console.log('Finished updating seeders'));
}
function enableScheduling() {

View File

@@ -63,8 +63,6 @@ async function updateTorrentSeeders(torrent) {
.catch(() => undefined)
.then(stored => {
if (stored) {
console.log(
`Updated seeder for ${torrent.provider} [${torrent.infoHash}] ${torrent.title} from ${stored.seeders} to ${torrent.seeders}`);
stored.seeders = torrent.seeders;
stored.changed('updatedAt', true);
return stored.save()