fix torrent9 null inforhash error

This commit is contained in:
TheBeastLT
2022-01-03 10:20:05 +01:00
parent faca41eb7c
commit 6b1c0a90ad
3 changed files with 3 additions and 3 deletions

View File

@@ -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),

View File

@@ -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;
}

View File

@@ -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],