platers / unitunes

A GUI and library to transfer, sync, and backup playlists on music streaming services
GNU General Public License v3.0
130 stars 12 forks source link

Support a different YouTube playlist URL #20

Open Sinderella opened 1 year ago

Sinderella commented 1 year ago

First of all, thank you for this great piece of software.

I couldn't get the right YT playlist URL format at first, then I noticed the supported URL format is different. The one I got from my address bar when browsing is as follows:

https://music.youtube.com/browse/<playlist-id>

Alternatively, as we have to specify the service anyway, wouldn't it be better if we just enter the playlist ID?

platers commented 1 year ago

I usually click the share button on the playlist to get the url, which is why its this way. Adding more parsing options would be good.

Sinderella commented 1 year ago

Using the share button also results in the following error.

Traceback (most recent call last):
  File "/path/clones/unitunes/unitunes/gui/engine.py", line 109, in _process_queue
    job.execute()
  File "/path/clones/unitunes/unitunes/gui/engine.py", line 66, in execute
    self.pm.pull_playlist(
  File "/path/clones/unitunes/unitunes/main.py", line 205, in pull_playlist
    remote_metadata = service.pull_metadata(uri)
  File "/path/clones/unitunes/unitunes/services/ytm.py", line 224, in pull_metadata
    res = self.wrapper.get_playlist(uri.uri)
  File "/path/clones/unitunes/unitunes/services/ytm.py", line 45, in get_playlist
    return self.ytm.get_playlist(*args, **kwargs)
  File "/path/Library/Caches/pypoetry/virtualenvs/unitunes-it616VEz-py3.10/lib/python3.10/site-packages/ytmusicapi/mixins/playlists.py", line 68, in get_playlist
    results = nav(response,
  File "/path/Library/Caches/pypoetry/virtualenvs/unitunes-it616VEz-py3.10/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 155, in nav
    raise err
  File "/path/Library/Caches/pypoetry/virtualenvs/unitunes-it616VEz-py3.10/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 149, in nav
    root = root[k]

URL:

https://music.youtube.com/playlist?list=<playlist-id>&feature=share

Removing the feature parameter seems to sort it. I suppose we're not parsing the URL properly. I would suggest using urllib.parse.

I apologise as I am unable to contribute as I will be traveling for the next 2 weeks.