unitunes icon indicating copy to clipboard operation
unitunes copied to clipboard

Support a different YouTube playlist URL

Open Sinderella opened this issue 2 years ago • 2 comments

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?

Sinderella avatar Aug 27 '22 14:08 Sinderella

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.

platers avatar Aug 27 '22 16:08 platers

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.

Sinderella avatar Aug 28 '22 15:08 Sinderella