adds rarbg dump scraper based on scraped imdb ids

This commit is contained in:
TheBeastLT
2020-03-09 15:23:16 +01:00
parent ef09abc4e0
commit 2618694e33
8 changed files with 47214 additions and 7 deletions

View File

@@ -15,6 +15,10 @@ async function createTorrentEntry(torrent) {
torrent.imdbId = await getImdbId(titleInfo, torrent.type)
.catch(() => undefined);
}
if (torrent.imdbId && torrent.imdbId.length > 9 && torrent.imdbId.startsWith('tt0')) {
// sanitize imdbId from redundant zeros
torrent.imdbId = torrent.imdbId.replace(/tt0+([0-9]{7,})$/, 'tt$1');
}
if (!torrent.kitsuId && torrent.type === Type.ANIME) {
torrent.kitsuId = await getKitsuId(titleInfo)
.catch(() => undefined);
@@ -32,8 +36,8 @@ async function createTorrentEntry(torrent) {
return;
}
repository.createTorrent(torrent)
.then(() => files.forEach(file => repository.createFile(file)))
return repository.createTorrent(torrent)
.then(() => Promise.all(files.map(file => repository.createFile(file))))
.then(() => console.log(`Created entry for ${torrent.title}`));
}