Closed Wolletje01 closed 3 years ago
BTW this is the yt video with the - id in it. https://www.youtube.com/watch?v=DEXTLC-rPI4
What output do you get?
No normal output it just craches.
node bot.js D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\common\parser.js:357 var videoDetails = JSON.parse(html.split("var ytInitialPlayerResponse = ")[1].split(";")[0]).videoDetails; ^
SyntaxError: Unexpected token ; in JSON at position 77462
at JSON.parse (
The same applies to a _ in the id. https://www.youtube.com/watch?v=OGt7UIL6S_I id = OGt7UIL6S_I error: D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\common\parser.js:374 title: videoInfo.title.runs[0].text, ^
TypeError: Cannot read property 'runs' of undefined at Object.parseGetVideo (D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\common\parser.js:374:36) at D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\index.js:204:64 at step (D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\index.js:54:23) at Object.next (D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\index.js:35:53) at fulfilled (D:\aajie vps\scrape yt\node_modules\scrape-yt\dist\index.js:26:58) at processTicksAndRejections (node:internal/process/task_queues:93:5)
Can reproduce, going to take a look at this soon.
Try updating to 1.4.8
On another note, I will stop adding features to this library and only will do bug fixes. I was working for v2 of this library but I figured that it will be better to make a new library instead because the v2 doesn't scrape data from Youtube page anymore, instead sending a request to (what I assume to be) Youtube internal API for Youtube Web App.
It's called Youtubei, it's still in early stage but should be stable. It also should be faster than scrape-yt
. Go check it out 😁
Describe the bug The getVideo isnt working with a id with a "-"
To Reproduce have this piece of code
and run it. The id is valid but it doesn't work because it has a - in it.
Expected behavior I expected that everything works normal.