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.15k stars 1.58k forks source link

Can't download a specific playlist #1767

Closed amethyze closed 1 year ago

amethyze commented 1 year ago

System OS

Windows

Python Version

3.11 (CPython)

Install Source

GitHub

Install version / commit hash

v4.1.2

Expected Behavior vs Actual Behavior

I gave it a playlist link to download and gave it a bunch of additional arguments. It started the query, but immediately gave an error.

Steps to reproduce - Ensure to include actual links!

  1. Open cmd terminal
  2. Run spotdl --user-auth --sponsor-block --audio youtube-music --lyrics musixmatch --format mp3 --output "D:\Music\%today%\Dreaming at Night\{title} - {artist}.{output-ext}" download https://open.spotify.com/playlist/7b2A5wrFAeeGvt3YVbNzTo
  3. See error

Traceback

query: https://open.spotify.com/playlist/7b2A5wrFAeeGvt3YVbNzTo

--- Logging error ---
Traceback (most recent call last):
  File "spotdl\console\entry_point.py", line 120, in console_entry_point
  File "spotdl\console\download.py", line 25, in download
  File "spotdl\utils\search.py", line 180, in get_simple_songs
  File "spotdl\types\song.py", line 316, in from_url
  File "spotdl\types\playlist.py", line 97, in get_metadata
KeyError: 'album'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rich\syntax.py", line 497, in tokens_to_spans
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "rich\logging.py", line 170, in emit
  File "rich\console.py", line 1694, in print
  File "rich\console.py", line 1326, in render
  File "rich\table.py", line 511, in __rich_console__
  File "rich\table.py", line 824, in _render
  File "rich\console.py", line 1366, in render_lines
  File "rich\segment.py", line 292, in split_and_crop_lines
  File "rich\console.py", line 1326, in render
  File "rich\padding.py", line 97, in __rich_console__
  File "rich\console.py", line 1366, in render_lines
  File "rich\segment.py", line 292, in split_and_crop_lines
  File "rich\console.py", line 1330, in render
  File "rich\console.py", line 1330, in render
  File "rich\console.py", line 1330, in render
  File "rich\console.py", line 1326, in render
  File "rich\panel.py", line 220, in __rich_console__
  File "rich\console.py", line 1366, in render_lines
  File "rich\segment.py", line 292, in split_and_crop_lines
  File "rich\console.py", line 1326, in render
  File "rich\padding.py", line 97, in __rich_console__
  File "rich\console.py", line 1366, in render_lines
  File "rich\segment.py", line 292, in split_and_crop_lines
  File "rich\console.py", line 1330, in render
  File "rich\console.py", line 1326, in render
  File "rich\syntax.py", line 609, in __rich_console__
  File "rich\segment.py", line 668, in __init__
  File "rich\syntax.py", line 637, in _get_syntax
  File "rich\syntax.py", line 509, in highlight
  File "rich\text.py", line 995, in append_tokens
RuntimeError: generator raised StopIteration
Call stack:
  File "spotdl\__main__.py", line 9, in <module>
  File "spotdl\console\entry_point.py", line 127, in console_entry_point
  File "logging\__init__.py", line 1512, in exception
  File "logging\__init__.py", line 1506, in error
  File "logging\__init__.py", line 1624, in _log
  File "logging\__init__.py", line 1634, in handle
  File "logging\__init__.py", line 1696, in callHandlers
  File "logging\__init__.py", line 968, in handle
  File "rich\logging.py", line 172, in emit
Message: 'An error occurred'
Arguments: ()

Other details

No response

xnetcat commented 1 year ago

Do you know at which song did this error occur?

xnetcat commented 1 year ago

Should be fixed on dev branch

amethyze commented 1 year ago

Do you know at which song did this error occur?

It didn't even start downloading, happened at the first song

xnetcat commented 1 year ago

Do you know at which song did this error occur?

It didn't even start downloading, happened at the first song

Yup, looks fixed image

amethyze commented 1 year ago

It works on the dev branch, then?

xnetcat commented 1 year ago

It works on the dev branch, then?

Yeah, I've already fixed it here: https://github.com/spotDL/spotify-downloader/commit/710e1b567fbe8a2aa1b5356383ef209242e2d0b9

To update: pip install --force -U https://codeload.github.com/spotDL/spotify-downloader/zip/dev

amethyze commented 1 year ago

How weird, after updating with the command you gave me, and running the same command, I got a different error.



An error occurred
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\Python311\Lib\site-packages\spotdl\console\entry_point.py:120 in console_entry_point                             │
│                                                                                                                     │
│   117 │   try:                                                                                                      │
│   118 │   │   # Pick the operation to perform                                                                       │
│   119 │   │   # based on the name and run it!                                                                       │
│ > 120 │   │   OPERATIONS[arguments.operation](                                                                      │
│   121 │   │   │   query=arguments.query,                                                                            │
│   122 │   │   │   downloader=downloader,                                                                            │
│   123 │   │   )                                                                                                     │
│                                                                                                                     │
│ C:\Python311\Lib\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)                                                                  │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\utils\search.py:181 in get_simple_songs                                       │
│                                                                                                                     │
│   178 │   │   elif "open.spotify.com" in request and "track" in request:                                            │
│   179 │   │   │   songs.append(Song.from_url(url=request))                                                          │
│   180 │   │   elif "open.spotify.com" in request and "playlist" in request:                                         │
│ > 181 │   │   │   lists.append(Playlist.from_url(request, fetch_songs=False))                                       │
│   182 │   │   elif "open.spotify.com" in request and "album" in request:                                            │
│   183 │   │   │   lists.append(Album.from_url(request, fetch_songs=False))                                          │
│   184 │   │   elif "open.spotify.com" in request and "artist" in request:                                           │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\types\song.py:294 in from_url                                                 │
│                                                                                                                     │
│   291 │   │   - The SongList object.                                                                                │
│   292 │   │   """                                                                                                   │
│   293 │   │                                                                                                         │
│ > 294 │   │   metadata, songs = cls.get_metadata(url)                                                               │
│   295 │   │   urls = [song.url for song in songs]                                                                   │
│   296 │   │                                                                                                         │
│   297 │   │   if fetch_songs:                                                                                       │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\types\playlist.py:98 in get_metadata                                          │
│                                                                                                                     │
│    95 │   │   │   │   continue                                                                                      │
│    96 │   │   │                                                                                                     │
│    97 │   │   │   album_meta = track_meta.get("album", {})                                                          │
│ >  98 │   │   │   release_date = album_meta["release_date"]                                                         │
│    99 │   │   │                                                                                                     │
│   100 │   │   │   artists = [artist["name"] for artist in track_meta["artists"]]                                    │
│   101 │   │   │   song = Song.from_missing_data(                                                                    │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
KeyError: 'release_date'```
xnetcat commented 1 year ago

Ah I've missed one field, update again should be fixed again.

amethyze commented 1 year ago

Now it says something about the artists? Sorry, I'm not good with Python


Processing query: https://open.spotify.com/playlist/7b2A5wrFAeeGvt3YVbNzTo

An error occurred
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\Python311\Lib\site-packages\spotdl\console\entry_point.py:120 in console_entry_point                             │
│                                                                                                                     │
│   117 │   try:                                                                                                      │
│   118 │   │   # Pick the operation to perform                                                                       │
│   119 │   │   # based on the name and run it!                                                                       │
│ > 120 │   │   OPERATIONS[arguments.operation](                                                                      │
│   121 │   │   │   query=arguments.query,                                                                            │
│   122 │   │   │   downloader=downloader,                                                                            │
│   123 │   │   )                                                                                                     │
│                                                                                                                     │
│ C:\Python311\Lib\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)                                                                  │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\utils\search.py:181 in get_simple_songs                                       │
│                                                                                                                     │
│   178 │   │   elif "open.spotify.com" in request and "track" in request:                                            │
│   179 │   │   │   songs.append(Song.from_url(url=request))                                                          │
│   180 │   │   elif "open.spotify.com" in request and "playlist" in request:                                         │
│ > 181 │   │   │   lists.append(Playlist.from_url(request, fetch_songs=False))                                       │
│   182 │   │   elif "open.spotify.com" in request and "album" in request:                                            │
│   183 │   │   │   lists.append(Album.from_url(request, fetch_songs=False))                                          │
│   184 │   │   elif "open.spotify.com" in request and "artist" in request:                                           │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\types\song.py:294 in from_url                                                 │
│                                                                                                                     │
│   291 │   │   - The SongList object.                                                                                │
│   292 │   │   """                                                                                                   │
│   293 │   │                                                                                                         │
│ > 294 │   │   metadata, songs = cls.get_metadata(url)                                                               │
│   295 │   │   urls = [song.url for song in songs]                                                                   │
│   296 │   │                                                                                                         │
│   297 │   │   if fetch_songs:                                                                                       │
│                                                                                                                     │
│ C:\Python311\Lib\site-packages\spotdl\types\playlist.py:100 in get_metadata                                         │
│                                                                                                                     │
│    97 │   │   │   album_meta = track_meta.get("album", {})                                                          │
│    98 │   │   │   release_date = album_meta.get("release_date")                                                     │
│    99 │   │   │                                                                                                     │
│ > 100 │   │   │   artists = [artist["name"] for artist in track_meta["artists"]]                                    │
│   101 │   │   │   song = Song.from_missing_data(                                                                    │
│   102 │   │   │   │   name=track_meta["name"],                                                                      │
│   103 │   │   │   │   artists=artists,                                                                              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
KeyError: 'artists'```