SuspiciousLookingOwl / scrape-yt

Simple lib to scrape information from youtube such as search results, video information, related videos, playlist information and up next video
https://www.npmjs.com/package/scrape-yt
MIT License
9 stars 3 forks source link

[BUG] getVideo & getPlaylist #25

Closed AceAsin closed 3 years ago

AceAsin commented 3 years ago

Bug Description The getVideo and getPlaylist function are returning an empty object.

To Reproduce Add a video or playlist id to the getVideo or getPlaylist function.

Expected Behavior Returns an empty object, no error message.

Additional Context I'm not sure if it's also happening with getRelated or getUpNext. Since I don't use those functions, no testing happened. It works fine for the search function, though.

SuspiciousLookingOwl commented 3 years ago

Does this happen on any video id / playlist id?

Are you using VPN by any chance?

AceAsin commented 3 years ago

I'm not using a VPN, I'm local testing and it's happened to every URL I've tried.

For getPlaylist, on any URL, it's actually not returning anything, no error message either.

SuspiciousLookingOwl commented 3 years ago

Oh I think it's because you are passing an URL instead of playlist id, you are supposed to pass playlist id.

For example if the playlist URL is https://www.youtube.com/playlist?list=PL0vfts4VzfNiI1BsIK5u7LpPaIDKMJIDN, then the playlist id is PL0vfts4VzfNiI1BsIK5u7LpPaIDKMJIDN, so you need to do

scrapeYt.getPlaylist("PL0vfts4VzfNiI1BsIK5u7LpPaIDKMJIDN");

instead of

scrapeYt.getPlaylist("https://www.youtube.com/playlist?list=PL0vfts4VzfNiI1BsIK5u7LpPaIDKMJIDN");
AceAsin commented 3 years ago

I know I'm supposed to pass a playlist id. I've been passing a playlist id and video id. It was previously working and suddenly when I checked it stopped returning information.

For getVideo, if I loop an array of id's, it will return empty objects, but it will capture only a few videos out of them all, eventually some will return information, but that's like a 1/15 chance.

If it's working fine for everyone else but not me, then it's probably just on my end, but like I said before, it was all previously working just fine, then stopped suddenly.

AceAsin commented 3 years ago

You mentioned a VPN, so I tried with a VPN and it works fine. I might've been rate limited on my actual IP or something.

SuspiciousLookingOwl commented 3 years ago

You mentioned a VPN, so I tried with a VPN and it works fine. I might've been rate limited on my actual IP or something.

Might be true, but I never got rate limited from Youtube even after sending hundreds of request in a short time. Need to investigate more on this, but I'm planning to rewrite the whole lib with better scraping algorithm soon, so hopefully that will fix this.

AceAsin commented 3 years ago

Yeah, I hadn't even done any recent requests in like 2 days, so not sure either.

I'll look forward to the rewritten library when you complete it.

SuspiciousLookingOwl commented 3 years ago

v2 alpha is out. There's no doc yet but you can check the CHANGELOG for breaking changes from v1.