diff --git a/scraper/scrapers/torrent9/torrent9_api.js b/scraper/scrapers/torrent9/torrent9_api.js index 89d9078..f9498d4 100644 --- a/scraper/scrapers/torrent9/torrent9_api.js +++ b/scraper/scrapers/torrent9/torrent9_api.js @@ -103,7 +103,7 @@ function parseTorrentPage(body) { const languages = parse(name).languages; const torrent = { title: name.trim(), - infoHash: decode(magnetLink).infoHash, + infoHash: magnetLink ? decode(magnetLink).infoHash : undefined, magnetLink: magnetLink, torrentLink: torrentLink ? `${baseUrl}${torrentLink}` : undefined, seeders: parseInt(details.find('.movie-information ul:nth-of-type(1) li:nth-of-type(3)').text(), 10), diff --git a/scraper/scrapers/torrent9/torrent9_scraper.js b/scraper/scrapers/torrent9/torrent9_scraper.js index 7eaa514..0ddab87 100644 --- a/scraper/scrapers/torrent9/torrent9_scraper.js +++ b/scraper/scrapers/torrent9/torrent9_scraper.js @@ -63,7 +63,7 @@ async function processTorrentRecord(client, record) { } const foundTorrent = await api_limiter.schedule(() => client.torrent(record.torrentId)).catch(() => undefined); - if (!foundTorrent) { + if (!foundTorrent || !foundTorrent.infoHash) { console.warn(`Failed retrieving torrent ${record.torrentId}`); return record; } diff --git a/scraper/scrapers/torrent9/torrent9v2_api.js b/scraper/scrapers/torrent9/torrent9v2_api.js index c51d281..e6ce580 100644 --- a/scraper/scrapers/torrent9/torrent9v2_api.js +++ b/scraper/scrapers/torrent9/torrent9v2_api.js @@ -98,7 +98,7 @@ function parseTorrentPage(body) { const languages = parse(name).languages; const torrent = { title: name.trim(), - infoHash: decode(magnetLink).infoHash, + infoHash: magnetLink ? decode(magnetLink).infoHash : undefined, magnetLink: magnetLink, seeders: parseInt(details.find('.movie-information ul:nth-of-type(1) li:nth-of-type(3)').text(), 10), category: details.find('ul:nth-of-type(4) a').attr('href').match(/_(\w+)\.html$/)[1],