mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] updates hs mapping
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user