spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17.48k stars 1.6k forks source link

Ytm playlist value type not working #1952

Closed jnxr closed 1 year ago

jnxr commented 1 year ago

System OS

Windows

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.2.1

Expected Behavior vs Actual Behavior

Ytm playlist link formats which work with spotdl:

https://music.youtube.com/playlist?list=PLE1D25BF1739D5963 https://music.youtube.com/playlist?list=PLK-vTBQHteiSCd15b1sDO8QGhhlrpO87V

This type not working atm: https://music.youtube.com/playlist?list=OLAK5uy_nbMYyrfeg5ZgknoOsOGBL268hGxtcbnDM

Steps to reproduce - Ensure to include actual links!

spotdl https://music.youtube.com/playlist?list=OLAK5uy_nbMYyrfeg5ZgknoOsOGBL268hGxtcbnDM

Traceback

[08:34:17] DEBUG    MainThread - Downloader settings: {'audio_providers': ['youtube-music'],           downloader.py:128
                    'lyrics_providers': ['genius', 'azlyrics', 'musixmatch'], 'playlist_numbering':
                    False, 'scan_for_songs': False, 'm3u': '.{list}', 'output': '{artists} -
                    {title}.{output-ext}', 'overwrite': 'skip', 'search_query': None, 'ffmpeg':
                    'ffmpeg', 'bitrate': 'disable', 'ffmpeg_args': None, 'format': 'm4a', 'save_file':
                    '.spotdl', 'filter_results': True, 'threads': 2, 'cookie_file':
                    'C:\\W.txt', 'restrict': False, 'print_errors': True,
                    'sponsor_block': False, 'preload': True, 'archive': None, 'load_config': True,
                    'log_level': 'DEBUG', 'simple_tui': False, 'fetch_albums': False, 'id3_separator':
                    '/', 'ytm_data': False, 'add_unavailable': False, 'generate_lrc': False,
                    'force_update_metadata': False, 'only_verified_results': False,
                    'sync_without_deleting': False, 'max_filename_length': None, 'yt_dlp_args': None,
                    'detect_formats': ['m4a'], 'save_errors': None}
[08:34:17] DEBUG    MainThread - FFmpeg path: ffmpeg                                                   downloader.py:146
[08:34:17] DEBUG    MainThread - Found 0 known songs                                                   downloader.py:179
[08:34:19] DEBUG    MainThread - Archive: 0 urls                                                       downloader.py:214
[08:34:19] DEBUG    MainThread - Downloader initialized                                                downloader.py:216
[08:34:19] INFO     MainThread - Processing query:                                                         search.py:130
                    https://music.youtube.com/playlist?list=OLAK5uy_nbMYyrfeg5ZgknoOsOGBL268hGxtcbnDM

[8:34:20 AM] ERROR    MainThread - An error occurred                                                  entry_point.py:132
                      ╭───────────────────── Traceback (most recent call last) ─────────────────────╮
                      │ C:\Program                                                                  │
                      │ Files\Python311\Lib\site-packages\spotdl\console\entry_point.py:125 in      │
                      │ console_entry_point                                                         │
                      │                                                                             │
                      │   122 │   try:                                                              │
                      │   123 │   │   # Pick the operation to perform                               │
                      │   124 │   │   # based on the name and run it!                               │
                      │ ❱ 125 │   │   OPERATIONS[arguments.operation](                              │
                      │   126 │   │   │   query=arguments.query,                                    │
                      │   127 │   │   │   downloader=downloader,                                    │
                      │   128 │   │   )                                                             │
                      │                                                                             │
                      │ C:\Program Files\Python311\Lib\site-packages\spotdl\console\download.py:25  │
                      │ in download                                                                 │
                      │                                                                             │
                      │   22 │   """                                                                │
                      │   23 │                                                                      │
                      │   24 │   # Parse the query                                                  │
                      │ ❱ 25 │   songs = get_simple_songs(                                          │
                      │   26 │   │   query,                                                         │
                      │   27 │   │   use_ytm_data=downloader.settings["ytm_data"],                  │
                      │   28 │   │   playlist_numbering=downloader.settings["playlist_numbering"],  │
                      │                                                                             │
                      │ C:\Program Files\Python311\Lib\site-packages\spotdl\utils\search.py:186 in  │
                      │ get_simple_songs                                                            │
                      │                                                                             │
                      │   183 │   │   │   split_urls = request.split("|")                           │
                      │   184 │   │   │   if len(split_urls) == 1:                                  │
                      │   185 │   │   │   │   if "?list=OLAK5uy_" in request:                       │
                      │ ❱ 186 │   │   │   │   │   lists.append(create_ytm_album(request, fetch_song │
                      │   187 │   │   │   │   elif "?list=PL" in request or "browse/VLPL" in reques │
                      │   188 │   │   │   │   │   lists.append(create_ytm_playlist(request, fetch_s │
                      │   189 │   │   │   else:                                                     │
                      │                                                                             │
                      │ C:\Program Files\Python311\Lib\site-packages\spotdl\utils\search.py:495 in  │
                      │ create_ytm_album                                                            │
                      │                                                                             │
                      │   492 │   │   url.split("?list=")[1].split("&")[0]                          │
                      │   493 │   )                                                                 │
                      │   494 │   if browse_id is None:                                             │
                      │ ❱ 495 │   │   raise ValueError(f"Invalid album url: {url}")                 │
                      │   496 │                                                                     │
                      │   497 │   album = get_ytm_client().get_album(browse_id)                     │
                      │   498                                                                       │
                      ╰─────────────────────────────────────────────────────────────────────────────╯
                      ValueError: Invalid album url:
                      https://music.youtube.com/playlist?list=OLAK5uy_nbMYyrfeg5ZgknoOsOGBL268hGxtcbn
                      DM

Other details

No response

bharat-nair commented 1 year ago

This was due to a bug in ytmusicapi and is fixed in v1.3.2: 470