mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-04-20 22:32:05 +00:00
[scraper] disallow rutor russian series without imdb id
This commit is contained in:
parent
fae2e8f360
commit
817d64f2eb
1 changed files with 11 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const Bottleneck = require('bottleneck');
|
const Bottleneck = require('bottleneck');
|
||||||
|
const { parse } = require('parse-torrent-title');
|
||||||
const rutor = require('./rutor_api');
|
const rutor = require('./rutor_api');
|
||||||
const { Type } = require('../../lib/types');
|
const { Type } = require('../../lib/types');
|
||||||
const repository = require('../../lib/repository');
|
const repository = require('../../lib/repository');
|
||||||
|
|
@ -17,8 +18,7 @@ const TYPE_MAPPING = {
|
||||||
'tv': Type.SERIES,
|
'tv': Type.SERIES,
|
||||||
'multiki': Type.MOVIE,
|
'multiki': Type.MOVIE,
|
||||||
'anime': Type.ANIME
|
'anime': Type.ANIME
|
||||||
}
|
};
|
||||||
const ALLOWED_WITHOUT_IMDB = ['kino', 'seriali', 'anime'];
|
|
||||||
|
|
||||||
const api_limiter = new Bottleneck({ maxConcurrent: 1, minTime: 5000 });
|
const api_limiter = new Bottleneck({ maxConcurrent: 1, minTime: 5000 });
|
||||||
const api_entry_limiter = new Bottleneck({ maxConcurrent: 1, minTime: 2500 });
|
const api_entry_limiter = new Bottleneck({ maxConcurrent: 1, minTime: 2500 });
|
||||||
|
|
@ -90,7 +90,7 @@ async function processTorrentRecord(record) {
|
||||||
if (!foundTorrent || !TYPE_MAPPING[foundTorrent.category]) {
|
if (!foundTorrent || !TYPE_MAPPING[foundTorrent.category]) {
|
||||||
return Promise.resolve(`${NAME}: Invalid torrent record: ${record.torrentId}`);
|
return Promise.resolve(`${NAME}: Invalid torrent record: ${record.torrentId}`);
|
||||||
}
|
}
|
||||||
if (!foundTorrent.imdbId && !ALLOWED_WITHOUT_IMDB.includes(foundTorrent.category)) {
|
if (!foundTorrent.imdbId && disallowWithoutImdbId(foundTorrent)) {
|
||||||
return Promise.resolve(`${NAME}: No imdbId defined: ${record.torrentId}`);
|
return Promise.resolve(`${NAME}: No imdbId defined: ${record.torrentId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,4 +122,12 @@ function getMaxPage(category) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function disallowWithoutImdbId(torrent) {
|
||||||
|
if (['kino', 'anime'].includes(torrent.category)) {
|
||||||
|
return false; // allow to search foreign movie and anime ids via search
|
||||||
|
}
|
||||||
|
// allow to search id for non russian series titles via search
|
||||||
|
return !(torrent.category === 'seriali' && !parse(torrent.title).title.match(/[\u0400-\u04ff]/i));
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = { scrape, updateSeeders, NAME };
|
module.exports = { scrape, updateSeeders, NAME };
|
||||||
Loading…
Reference in a new issue