youtube-playlist icon indicating copy to clipboard operation
youtube-playlist copied to clipboard

Not getting Playlist song list

Open learnswifty opened this issue 5 years ago • 4 comments

@CodeDotJS Right now, I have faced an issue with getting the video list from playlist id (also use same in the description)

{ data: { name: '', playlist: [] } }

learnswifty avatar Nov 10 '20 13:11 learnswifty

@lefuturiste can you please show me the code?

CodeDotJS avatar Nov 10 '20 13:11 CodeDotJS

@CodeDotJS I'm using simply your description code with browserify module. It did work yesterday. but right now not.

ytlist(url, ['id', 'name', 'url']).then(res => { console.log(res.data); });

http://browserify.org/

learnswifty avatar Nov 10 '20 13:11 learnswifty

Hi I have the same problem in my Code and on RunKit too

heldcraft-zz avatar Nov 10 '20 16:11 heldcraft-zz

I can also confirm this, my theory is that the disable_polymer parameter is no longer working. I tried to tweak the selectors but in the HTML markup, the elements are no longer there. They are however in window.ytInitialData.

To fix it for my use case I created my own scraper here, the response is similar to this library, but the API is not: https://github.com/Aidurber/youtube-playlist-scraper

Most of the magic is here:

Since there are a number of users depending on this library, I think it would be easy enough to port/add a fallback to ytInitialData scraping.

But much like the DOM selectors, if YouTube decides to change the shape of the initialData object, the scraper will break. That's just the risk of relying on a third-party.

Aidurber avatar Nov 11 '20 21:11 Aidurber

If it was working yesterday, must be a dodgy update, just downgrade your npm and it should work.

MaragiDev avatar Mar 13 '23 16:03 MaragiDev