spotify-downloader: Download `all-user-playlists` crashes with Index error

System OS

Linux

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.2.0

Expected Behavior vs Actual Behavior

No response

Steps to reproduce - Ensure to include actual links!

spotdl all-user-playlists --user-auth

Traceback

$ spotdl all-user-playlists --user-auth
Processing query: all-user-playlists                                                                 

An error occurred                                                                                    
╭──────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/console/entry_point.py:124 in console_entry_point  │
│                                                                                                   │
│   121 │   try:                                                                                    │
│   122 │   │   # Pick the operation to perform                                                     │
│   123 │   │   # based on the name and run it!                                                     │
│ ❱ 124 │   │   OPERATIONS[arguments.operation](                                                    │
│   125 │   │   │   query=arguments.query,                                                          │
│   126 │   │   │   downloader=downloader,                                                          │
│   127 │   │   )                                                                                   │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/console/download.py:25 in download                 │
│                                                                                                   │
│   22 │   """                                                                                      │
│   23 │                                                                                            │
│   24 │   # Parse the query                                                                        │
│ ❱ 25 │   songs = get_simple_songs(query, use_ytm_data=downloader.settings["ytm_data"])            │
│   26 │                                                                                            │
│   27 │   # Download the songs                                                                     │
│   28 │   downloader.download_multiple_songs(songs)                                                │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/utils/search.py:240 in get_simple_songs            │
│                                                                                                   │
│   237 │   │   elif request == "saved":                                                            │
│   238 │   │   │   lists.append(Saved.from_url(request, fetch_songs=False))                        │
│   239 │   │   elif request == "all-user-playlists":                                               │
│ ❱ 240 │   │   │   lists.extend(get_all_user_playlists())                                          │
│   241 │   │   elif request.endswith(".spotdl"):                                                   │
│   242 │   │   │   with open(request, "r", encoding="utf-8") as save_file:                         │
│   243 │   │   │   │   for track in json.load(save_file):                                          │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/utils/search.py:328 in get_all_user_playlists      │
│                                                                                                   │
│   325 │   │   user_playlists_response = response                                                  │
│   326 │   │   user_playlists.extend(user_playlists_response["items"])                             │
│   327 │                                                                                           │
│ ❱ 328 │   return [                                                                                │
│   329 │   │   Playlist.from_url(playlist["external_urls"]["spotify"], fetch_songs=False)          │
│   330 │   │   for playlist in user_playlists                                                      │
│   331 │   ]                                                                                       │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/utils/search.py:329 in <listcomp>                  │
│                                                                                                   │
│   326 │   │   user_playlists.extend(user_playlists_response["items"])                             │
│   327 │                                                                                           │
│   328 │   return [                                                                                │
│ ❱ 329 │   │   Playlist.from_url(playlist["external_urls"]["spotify"], fetch_songs=False)          │
│   330 │   │   for playlist in user_playlists                                                      │
│   331 │   ]                                                                                       │
│   332                                                                                             │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/types/song.py:296 in from_url                      │
│                                                                                                   │
│   293 │   │   - The SongList object.                                                              │
│   294 │   │   """                                                                                 │
│   295 │   │                                                                                       │
│ ❱ 296 │   │   metadata, songs = cls.get_metadata(url)                                             │
│   297 │   │   urls = [song.url for song in songs]                                                 │
│   298 │   │                                                                                       │
│   299 │   │   if fetch_songs:                                                                     │
│                                                                                                   │
│ /tmp/.venv/lib/python3.11/site-packages/spotdl/types/playlist.py:108 in get_metadata              │
│                                                                                                   │
│   105 │   │   │   song = Song.from_missing_data(                                                  │
│   106 │   │   │   │   name=track_meta["name"],                                                    │
│   107 │   │   │   │   artists=artists,                                                            │
│ ❱ 108 │   │   │   │   artist=artists[0],                                                          │
│   109 │   │   │   │   album_id=album_meta.get("id"),                                              │
│   110 │   │   │   │   album_name=album_meta.get("name"),                                          │
│   111 │   │   │   │   album_artist=album_meta.get("artists", [])[0]["name"]                       │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: list index out of range


### Other details

_No response_

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

Btw, any updates on the Index error crash?

I am way too busy right now, I will have some time on the next Friday so maybe then I will fix this, until then if someone is interested in fixing this issue feel free to do so.