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.96k stars 1.51k forks source link

Can't download a playlist. Console hangs then gives a TypeError: cannot unpack non-iterable NoneType object #1067

Closed gordominossi closed 3 years ago

gordominossi commented 3 years ago

Environment


Expected Behaviour

Expected to download a playlist

Actual Behaviour

Console hung for a while and gave me an error:

TypeError: cannot unpack non-iterable NoneType object

Steps to Reproduce

  1. Clean up previous installation:
    pip3-autoremove spotdl
  2. Install spotdl from github:
    pip install https://codeload.github.com/spotDL/spotify-downloader/zip/master
    pip3-autoremove pytube
    pip install git+https://github.com/nficano/pytube
  3. Run it:
    spotdl https://open.spotify.com/playlist/7JAdfJue28XcbNFaAM7xKf
  4. ??
  5. profit

Traceback

Fetching Playlist...
Traceback (most recent call last):
  File "/usr/local/bin/spotdl", line 8, in <module>
    sys.exit(console_entry_point())
  File "/usr/local/lib/python3.9/site-packages/spotdl/__main__.py", line 111, in console_entry_point
    songObjList = get_playlist_tracks(request)
  File "/usr/local/lib/python3.9/site-packages/spotdl/search/utils.py", line 82, in get_playlist_tracks
    song = SongObj.from_url(
  File "/usr/local/lib/python3.9/site-packages/spotdl/search/songObj.py", line 66, in from_url
    youtubeLink = SongObj.searchProvider(
  File "/usr/local/lib/python3.9/site-packages/spotdl/search/provider.py", line 478, in search_and_get_best_match
    results = search_and_order_ytm_results(
  File "/usr/local/lib/python3.9/site-packages/spotdl/search/provider.py", line 366, in search_and_order_ytm_results
    results = __query_and_simplify(songSearchStr)
  File "/usr/local/lib/python3.9/site-packages/spotdl/search/provider.py", line 176, in __query_and_simplify
    linkBlock = contents['musicResponsiveListItemRenderer'] \
KeyError: 'playNavigationEndpoint'
Exception ignored in: <function tqdm.__del__ at 0x107e5cdc0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1126, in __del__
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1273, in close
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1458, in display
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1129, in __repr__
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1416, in format_dict
TypeError: cannot unpack non-iterable NoneType object

Any other information:

Sorry for saying this here, but I really liked spotdl V2. Sadly it doesn't work anymore, but I couldn't download a single song with spotdl V3. If anyone knows how to get V2 working again, I'd be really happy :)

gordominossi commented 3 years ago

Somewhat related to #1025, but that person got another error, and then this one. Tried all the fixes suggested on that conversation, one by one. None changed the error message I am getting. Thought this deserved its own issue.

gordominossi commented 3 years ago

Just downloaded the album and the song from the example. Only playlists are not working

Erik262 commented 3 years ago

Exactly same error here on BigSur

Silverarmor commented 3 years ago

@gordominossi Firstly: Any reason you have 2 versions of python installed? Stick to just using python 3 unless you have a reason to still have py2 installed. Also note that your python v3 is outdated. EDIT: Your stacktrace uses python 3.9 - What information are you giving us at the top?

Your only stated install source was a pytube link. This is spotDL, not pytube. Please follow the issue template - You did provide this information later on in the issue, but I could not find it easily at the top.

If installed from master/github, we need a commit hash, to know when it was installed. pip show spotdl will not help us.

spotDL's original author, ritiek attempts to maintain a v2 fork. See it at ritiek/spotify-downloader, but it is currently dysfunctional, and has no support from the spotDL team.

Silverarmor commented 3 years ago

Noted that this is actually a duplicate of #1038, and is fixed in commit 162d7ce

Comment below if still experiencing issues after installing from master again.

nullcount commented 3 years ago

Just built from master and still getting this error.

gordominossi commented 3 years ago

Sorry if I was rude or something that caused anyone any bad feelings. I'm just trying to help, reporting a bug I found.

I am using python 2 and 3 because I have programs that use python 2 and programs that use python 3. I said I use version 3.7.3 because that's what I get when I run python3 --version.

I have made a mistake when I wrote the bug report, I was sleepy, pardon me. I tried installing spotdl from different sources and the last one was using pip3 install https://codeload.github.com/spotDL/spotify-downloader/zip/master. Now I've tried from commit 162d7ce (latest commit of the master branch as of writing this comment) and got the same error message when trying to download a playlist.

Tried downloading a track and an album and for track I get Skipping ... as no match could be found on youtube and for album, TypeError: cannot unpack non-iterable NoneType object

gordominossi commented 3 years ago

Actually, different error, same message (for the playlist). Here's the traceback

Fetching Playlist...                                                                                
Traceback (most recent call last):
  File "/usr/local/bin/spotdl", line 8, in <module>
    sys.exit(console_entry_point())
  File "/usr/local/lib/python3.9/site-packages/spotdl/__main__.py", line 113, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/downloader.py", line 88, in download_multiple_songs
    self.downloadTracker.load_song_list(songObjList)
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 177, in load_song_list
    self.backup_to_disk()
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 196, in backup_to_disk
    remove(self.saveFile)
TypeError: remove: path should be string, bytes or os.PathLike, not NoneType
Exception ignored in: <function tqdm.__del__ at 0x103789d30>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1135, in __del__
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1282, in close
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1467, in display
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1138, in __repr__
  File "/usr/local/lib/python3.9/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1425, in format_dict
TypeError: cannot unpack non-iterable NoneType object
Silverarmor commented 3 years ago

Appears to be a duplicate of #1044 then.

gordominossi commented 3 years ago

Thanks, will look into it

drepram commented 3 years ago

The commands below fixed my issue:

sudo pip3 install python3-pip-autoremove
pip3 install pip-autoremove
pip3-autoremove spotdl
pip3 install spotdl
spotdl https://open.spotify.com/track/7meYcjUYsTwiAZUp8nKIZl?si=fd11ffd15fe74fa9