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
15.55k stars 1.48k forks source link

error if spotify playlist has no image #2088

Open scaphandroid opened 1 month ago

scaphandroid commented 1 month ago

System OS

Linux

Python Version

3.10 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.2.5

Expected Behavior vs Actual Behavior

No response

Steps to reproduce - Ensure to include actual links!

  1. get the url of a spotify playlist with no image ()
  2. use the command /home/vostok_admin/.local/bin/spotdl download --format flac --scan-for-songs --overwrite skip --m3u text.m3u

Traceback

An error occurred                                                                                        
╭────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────╮
│ /home/vostok_admin/.local/lib/python3.10/site-packages/spotdl/console/entry_point.py:142 in           │
│ console_entry_point                                                                                   │
│                                                                                                       │
│   139 │   try:                                                                                        │
│   140 │   │   # Pick the operation to perform                                                         │
│   141 │   │   # based on the name and run it!                                                         │
│ ❱ 142 │   │   OPERATIONS[arguments.operation](                                                        │
│   143 │   │   │   query=arguments.query,                                                              │
│   144 │   │   │   downloader=downloader,                                                              │
│   145 │   │   )                                                                                       │
│                                                                                                       │
│ /home/vostok_admin/.local/lib/python3.10/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"],                            │
│                                                                                                       │
│ /home/vostok_admin/.local/lib/python3.10/site-packages/spotdl/utils/search.py:260 in get_simple_songs │
│                                                                                                       │
│   257 │   │   │   )                                                                                   │
│   258 │   │   │   songs.extend(full_lists)                                                            │
│   259 │   │   elif "open.spotify.com" in request and "playlist" in request:                           │
│ ❱ 260 │   │   │   lists.append(Playlist.from_url(request, fetch_songs=False))                         │
│   261 │   │   elif "open.spotify.com" in request and "album" in request:                              │
│   262 │   │   │   lists.append(Album.from_url(request, fetch_songs=False))                            │
│   263 │   │   elif "open.spotify.com" in request and "artist" in request:                             │
│                                                                                                       │
│ /home/vostok_admin/.local/lib/python3.10/site-packages/spotdl/types/song.py:306 in from_url           │
│                                                                                                       │
│   303 │   │   - The SongList object.                                                                  │
│   304 │   │   """                                                                                     │
│   305 │   │                                                                                           │
│ ❱ 306 │   │   metadata, songs = cls.get_metadata(url)                                                 │
│   307 │   │   urls = [song.url for song in songs]                                                     │
│   308 │   │                                                                                           │
│   309 │   │   if fetch_songs:                                                                         │
│                                                                                                       │
│ /home/vostok_admin/.local/lib/python3.10/site-packages/spotdl/types/playlist.py:67 in get_metadata    │
│                                                                                                       │
│    64 │   │   │   │   │   │   else i["width"] * i["height"]                                           │
│    65 │   │   │   │   │   ),                                                                          │
│    66 │   │   │   │   )["url"]                                                                        │
│ ❱  67 │   │   │   │   if (len(playlist["images"]) > 0)                                                │
│    68 │   │   │   │   else ""                                                                         │
│    69 │   │   │   ),                                                                                  │
│    70 │   │   }                                                                                       │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: object of type 'NoneType' has no len()

Other details

No response