mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-04-21 11:01:55 +00:00
[scraper] updates hs mapping
This commit is contained in:
parent
ce0e330172
commit
9ea008572d
2 changed files with 6 additions and 5 deletions
|
|
@ -14,6 +14,8 @@ const thepiratebayDumpScraper = require('./scrapers/thepiratebay/thepiratebay_du
|
||||||
const thepiratebayUnofficialDumpScraper = require('./scrapers/thepiratebay/thepiratebay_unofficial_dump_scraper');
|
const thepiratebayUnofficialDumpScraper = require('./scrapers/thepiratebay/thepiratebay_unofficial_dump_scraper');
|
||||||
|
|
||||||
const PROVIDERS = [
|
const PROVIDERS = [
|
||||||
|
// require('./scrapers/thepiratebay/thepiratebay_update_size_scraper')
|
||||||
|
// require('./scrapers/1337x/1337x_dump_scraper')
|
||||||
horribleSubsScraper,
|
horribleSubsScraper,
|
||||||
rarbgScraper,
|
rarbgScraper,
|
||||||
thepiratebayScraper,
|
thepiratebayScraper,
|
||||||
|
|
@ -23,8 +25,8 @@ const PROVIDERS = [
|
||||||
// thepiratebayDumpScraper
|
// thepiratebayDumpScraper
|
||||||
// thepiratebayUnofficialDumpScraper
|
// thepiratebayUnofficialDumpScraper
|
||||||
];
|
];
|
||||||
const SCRAPE_CRON = process.env.SCRAPE_CRON || '0 0 */4 ? * *';
|
const SCRAPE_CRON = process.env.SCRAPE_CRON || '0 0 */4 ? * *'; // every 4 hours
|
||||||
const SEEDERS_CRON = '*/60 * * ? * *';
|
const SEEDERS_CRON = '0 */2 * ? * *'; // every 2 minutes
|
||||||
|
|
||||||
async function scrape() {
|
async function scrape() {
|
||||||
return PROVIDERS
|
return PROVIDERS
|
||||||
|
|
@ -41,7 +43,8 @@ async function updateSeeders() {
|
||||||
return getUpdateSeedersTorrents()
|
return getUpdateSeedersTorrents()
|
||||||
.then(torrents => Promise.all(torrents
|
.then(torrents => Promise.all(torrents
|
||||||
.map(torrent => PROVIDERS.find(provider => provider.NAME === torrent.provider)
|
.map(torrent => PROVIDERS.find(provider => provider.NAME === torrent.provider)
|
||||||
.updateSeeders(torrent))));
|
.updateSeeders(torrent))))
|
||||||
|
.then(() => console.log('Finished updating seeders'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableScheduling() {
|
function enableScheduling() {
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@ async function updateTorrentSeeders(torrent) {
|
||||||
.catch(() => undefined)
|
.catch(() => undefined)
|
||||||
.then(stored => {
|
.then(stored => {
|
||||||
if (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.seeders = torrent.seeders;
|
||||||
stored.changed('updatedAt', true);
|
stored.changed('updatedAt', true);
|
||||||
return stored.save()
|
return stored.save()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue