alexmercerind / youtube-search-python

πŸ”Ž Search for YouTube videos, channels & playlists. Get 🎞 video & πŸ“‘ playlist info using link. Get search suggestions. WITHOUT YouTube Data API v3.
MIT License
740 stars 164 forks source link

core/playlist: Fix series playlists by searching for playlistVideoListRenderer #143

Closed Zocker1999NET closed 2 years ago

Zocker1999NET commented 2 years ago

Some playlists like this one could not be extracted by youtube-search-python. This is probably due to that this channel has elected some playlists to be seasons of its "series". This is indicated by the season switcher at the top of the playlist page.

Because the UI looks different (the season switcher), the JSON sent by the server is different. By using jq on the embedded JSON, I detected that I could implement a search algorithm, which will search the content JSON for the key order required. This will hopefully not only add support for the playlist kind above, but probably for more playlists kinds YouTube has introduced so far or will introduce in the future.

Instead of assuming that the playlistVideoListRenderer is in the first content of the first tab ([0]), this algorithm will then split and search all items for the upcoming key path. It will then select the first non-None solution found, which will be the same solution for currently working playlists because the keys are searched for in list order.

mytja commented 2 years ago

Amazing. Thanks for your contribution.