diff --git a/scraper/index.js b/scraper/index.js index d0f71e9..bd3359d 100644 --- a/scraper/index.js +++ b/scraper/index.js @@ -50,10 +50,8 @@ server.get('/', function (req, res) { server.get('/realdebrid/:apiKey/:infoHash/:cachedFileIds/:fileIndex?', (req, res) => { const { apiKey, infoHash, cachedFileIds, fileIndex } = req.params; - console.log(`Unrestricting ${infoHash} [${fileIndex}]`); realDebrid.resolve(apiKey, infoHash, cachedFileIds, isNaN(fileIndex) ? undefined : parseInt(fileIndex)) .then(url => { - console.log(`Unrestricted ${infoHash} [${fileIndex}] to ${url}`); res.writeHead(301, { Location: url }); res.end(); }) diff --git a/scraper/moch/realdebrid.js b/scraper/moch/realdebrid.js index f0db71a..32b5334 100644 --- a/scraper/moch/realdebrid.js +++ b/scraper/moch/realdebrid.js @@ -24,6 +24,7 @@ async function resolve(apiKey, infoHash, cachedFileIds, fileIndex) { } async function _unrestrict(apiKey, infoHash, cachedFileIds, fileIndex) { + console.log(`Unrestricting ${infoHash} [${fileIndex}]`); const RD = new RealDebridClient(apiKey); const torrentId = await _createOrFindTorrentId(RD, infoHash, cachedFileIds); if (torrentId) { @@ -34,7 +35,9 @@ async function _unrestrict(apiKey, infoHash, cachedFileIds, fileIndex) { const fileLink = info.links.length === 1 ? info.links[0] : info.links[selectedFiles.indexOf(targetFile)]; - return _unrestrictLink(RD, fileLink); + const unrestrictedLink = await _unrestrictLink(RD, fileLink); + console.log(`Unrestricted ${infoHash} [${fileIndex}] to ${unrestrictedLink}`); + return unrestrictedLink; } return Promise.reject("Failed adding torrent"); }