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.4k stars 1.6k forks source link

Unable to download songs #1091

Closed NightMean closed 3 years ago

NightMean commented 3 years ago

Environment

Expected Behaviour

Song would be downloaded with correct metadata.

Actual Behaviour

Spotdl crashes

Steps to Reproduce

  1. Use command: spotdl https://open.spotify.com/track/0Vk5X3h5v1NDQhGzkRrt8m?si=sQVnZg3ASNeoTKFKqHfsJg

Traceback

michal@Michal-PC:/mnt/d/Music/Album Arts/SpotDL$ spotdl https://open.spotify.com/track/0Vk5X3h5v1NDQhGzkRrt8m?si=sQVnZg3ASNeoTKFKqHfsJg
Fetching Song...
Searching for: Alynda Segarra - Drunken Angel
 84%|███████████████████████████████████████████████████████████████████████████▊              |ETA: 00:00, 0.02min/songTraceback (most recent call last):
  File "/home/michal/.local/bin/spotdl", line 11, in <module>
    load_entry_point('spotdl==3.2.1', 'console_scripts', 'spotdl')()
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/__main__.py", line 96, in console_entry_point
    downloader.download_single_song(song)
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 76, in download_single_song
    self._download_asynchronously([songObj])
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 240, in download_song
    audioFile = EasyID3(convertedFilePath)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/easyid3.py", line 169, in __init__
    self.load(filename)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper
    return func(*args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 156, in wrapper
    return func(self, h, *args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/id3/_file.py", line 152, in load
    self._header = ID3Header(fileobj)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper
    return func(*args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/id3/_tags.py", line 59, in __init__
    raise ID3NoHeaderError("%s: too small" % fn)
mutagen.id3._util.ID3NoHeaderError: ./Alynda Segarra - Drunken Angel.mp3: too small
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1135, in __del__
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1282, in close
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1467, in display
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1138, in __repr__
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1425, in format_dict
TypeError: 'NoneType' object is not iterable

Any other information:

The file that gets downloaded has 0kb but the file in Temp folder is playable. I managed to replicate this error with multiple songs and I could not download any.

Silverarmor commented 3 years ago

Duplicate of #934 I cannot reproduce your error in v3.2.1 Appears your pytube might be outdated?

Try the following:

  1. pip install pip-autoremove
  2. pip-autoremove spotdl
  3. pip cache purge
  4. pip install spotl
NightMean commented 3 years ago

Done that multiple times even downloading the latest master. Purge command never worked

michal@Michal-PC:~/Downloads/IRS$ pip cache purge
ERROR: unknown command "cache" - maybe you meant "check"
Silverarmor commented 3 years ago

Is your pip up to date? pip install -U pip

Weird that you are unable to purge the cache. You could be installing an older version of something. Try pip install -U --no-cache-dir spotdl

NightMean commented 3 years ago

Updating pip seems to fix the purge command but upon doing that command I get this.. Could it interfere with spotdl?

WARNING: The directory '/home/michal/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: pip cache commands can not function since cache is disabled.
Silverarmor commented 3 years ago

Seems that pip does not have access to the cache directory. It should install spotDL normally though. Confirm you have tried to pip-autoremove and then install v3.2.1?

NightMean commented 3 years ago

Yes I did remove it and then installed latest. I tried different VM but I experienced same issue.

michal@Michal-PC:~/Downloads$ pip-autoremove spotdl
spotdl 3.2.1 (/home/michal/.local/lib/python3.6/site-packages)
    pytube 10.4.1 (/home/michal/.local/lib/python3.6/site-packages)
    tqdm 4.55.2 (/usr/local/lib/python3.6/dist-packages)
    rapidfuzz 0.14.2 (/home/michal/.local/lib/python3.6/site-packages)
    ytmusicapi 0.12.2 (/usr/local/lib/python3.6/dist-packages)
    spotipy 2.16.1 (/home/michal/.local/lib/python3.6/site-packages)
Uninstall (y/N)?y
Found existing installation: spotdl 3.2.1
Uninstalling spotdl-3.2.1:
  Successfully uninstalled spotdl-3.2.1
Found existing installation: spotipy 2.16.1
Uninstalling spotipy-2.16.1:
  Successfully uninstalled spotipy-2.16.1
Found existing installation: tqdm 4.55.2
Uninstalling tqdm-4.55.2:
  Successfully uninstalled tqdm-4.55.2
Found existing installation: pytube 10.4.1
Uninstalling pytube-10.4.1:
  Successfully uninstalled pytube-10.4.1
Found existing installation: rapidfuzz 0.14.2
Uninstalling rapidfuzz-0.14.2:
  Successfully uninstalled rapidfuzz-0.14.2
Found existing installation: ytmusicapi 0.12.2
Uninstalling ytmusicapi-0.12.2:
  Successfully uninstalled ytmusicapi-0.12.2
michal@Michal-PC:~/Downloads$ pip3 install ~/Downloads/spotify-downloader-3.2.1.zip --user
Processing ./spotify-downloader-3.2.1.zip
Requirement already satisfied: mutagen in /home/michal/.local/lib/python3.6/site-packages (from spotdl==3.2.1) (1.45.1)
Requirement already satisfied: requests in /home/michal/.local/lib/python3.6/site-packages (from spotdl==3.2.1) (2.25.1)
Collecting pytube
  Using cached pytube-10.4.1-py3-none-any.whl (42 kB)
Requirement already satisfied: typing-extensions in /home/michal/.local/lib/python3.6/site-packages (from pytube->spotdl==3.2.1) (3.7.4.3)
Collecting rapidfuzz
  Using cached rapidfuzz-0.14.2-cp36-cp36m-manylinux2010_x86_64.whl (4.4 MB)
Requirement already satisfied: idna<3,>=2.5 in /home/michal/.local/lib/python3.6/site-packages (from requests->spotdl==3.2.1) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/michal/.local/lib/python3.6/site-packages (from requests->spotdl==3.2.1) (1.26.2)
Requirement already satisfied: certifi>=2017.4.17 in /home/michal/.local/lib/python3.6/site-packages (from requests->spotdl==3.2.1) (2020.12.5)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/michal/.local/lib/python3.6/site-packages (from requests->spotdl==3.2.1) (4.0.0)
Collecting spotipy
  Using cached spotipy-2.16.1-py3-none-any.whl (24 kB)
Requirement already satisfied: six>=1.10.0 in /home/michal/.local/lib/python3.6/site-packages (from spotipy->spotdl==3.2.1) (1.15.0)
Collecting tqdm
  Using cached tqdm-4.55.2-py2.py3-none-any.whl (68 kB)
Collecting ytmusicapi
  Using cached ytmusicapi-0.12.2-py3-none-any.whl (38 kB)
Building wheels for collected packages: spotdl
  Building wheel for spotdl (setup.py) ... done
  Created wheel for spotdl: filename=spotdl-3.2.1-py3-none-any.whl size=24546 sha256=b0ef834a3e6508d438ac7c1702b349c58108890b4e3b914ae2f604c0166ba6ba
  Stored in directory: /home/michal/.cache/pip/wheels/3c/c5/8a/aa685e8e9d4cec03d89859543465762186eb17079e7e870b45
Successfully built spotdl
Installing collected packages: ytmusicapi, tqdm, spotipy, rapidfuzz, pytube, spotdl
Successfully installed pytube-10.4.1 rapidfuzz-0.14.2 spotdl-3.2.1 spotipy-2.16.1 tqdm-4.55.2 ytmusicapi-0.12.2
michal@Michal-PC:~/Downloads$ sudo python3 -m spotdl https://open.spotify.com/track/34lLAsdH4Y5TLf1B2SIj1I?si=m_b1hsDSQUyO7imN-5MpnQ
Fetching Song...
Searching for: Bad Wolves - Killing Me Slowly
 95%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████         |ETA: 00:00, 0.02min/songTraceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/__main__.py", line 130, in <module>
    console_entry_point()
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/__main__.py", line 96, in console_entry_point
    downloader.download_single_song(song)
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 76, in download_single_song
    self._download_asynchronously([songObj])
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 240, in download_song
    audioFile = EasyID3(convertedFilePath)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/easyid3.py", line 169, in __init__
    self.load(filename)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper
    return func(*args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 156, in wrapper
    return func(self, h, *args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/id3/_file.py", line 152, in load
    self._header = ID3Header(fileobj)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper
    return func(*args, **kwargs)
  File "/home/michal/.local/lib/python3.6/site-packages/mutagen/id3/_tags.py", line 59, in __init__
    raise ID3NoHeaderError("%s: too small" % fn)
mutagen.id3._util.ID3NoHeaderError: ./Bad Wolves - Killing Me Slowly.mp3: too small
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1134, in __del__
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1281, in close
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1467, in display
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1137, in __repr__
  File "/home/michal/.local/lib/python3.6/site-packages/spotdl/download/progressHandlers.py", line 23, in format_dict
  File "/home/michal/.local/lib/python3.6/site-packages/tqdm/std.py", line 1424, in format_dict
TypeError: 'NoneType' object is not iterable
Silverarmor commented 3 years ago

Firstly, I notice that you are running python3.6 - spotDL is dropping support of 3.6 shortly. We recommend you update.

Have you installed FFmpeg? Is it updated? the ID3NoHeaderError usually occurs with FFmpeg creating dummy files. See #990, #934 ffmpeg.org

NightMean commented 3 years ago

I apologize. I had ffmpeg v3 as that was the default from the repo. Updated to v4 and everything seems to work just fine 👍