[BUG] Cannot read property 'textContent' of null
Alejandro12120 opened this issue · comments
Describe the bug
This bug happens rarely but when it happens you can't get information about the video.
To Reproduce
let videos = [];
let urls = JSON.parse(fs.readFileSync("./videos.json"));
pornhub.page(urls[0], ['title', 'thumbnail_url']).then(video => {
videos.push(video);
urls.shift();
removeNext(urls);
});
function removeNext(urls) {
if (typeof urls !== 'undefined' && urls.length === 0) {
console.log("Done");
return;
}
pornhub.page(urls[0], ['title', 'thumbnail_url']).then(video => {
videos.push(video);
urls.shift();
removeNext(urls);
});
}
Full error log
TypeError: Cannot read property 'textContent' of null
at Object.scrap_javascript (C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\helpers\utils_scrap.js:36:52)
at C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\helpers\utils_scrap.js:52:39
at Array.map (<anonymous>)
at Object.scrap (C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\helpers\utils_scrap.js:45:47)
at Object.scraper_content_informations (C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\helpers\utils_scrap.js:10:25)
at Object.scraping_page (C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\page.js:59:37)
at Object.page (C:\Users\Alejandro\Desktop\x\node_modules\@justalk\pornhub-api\src\index.js:23:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Well apparently the error was fixed.