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.8k stars 1.62k forks source link

urllib.error.HTTPError: Getting 404 Not Found #1342

Closed Leg3ndary closed 3 years ago

Leg3ndary commented 3 years ago

System OS: Windows

Expected Behaviour

Finish downloading the song without returning 404

Actual Behaviour

Returns urllib.error.HTTPError: HTTP Error 404: Not Found

Steps to Reproduce

  1. Run spotdl
  2. Get the error

Traceback

Traceback (most recent call last):
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\spotdl\download\downloader.py", line
270, in download_song
    youtubeHandler.streams.filter(only_audio=True)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 321, in
streams
    return StreamQuery(self.fmt_streams)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 214, in
fmt_streams
    if "adaptive_fmts" in self.player_config_args:
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 188, in
player_config_args
    self._player_config_args = self.vid_info
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 291, in
vid_info
    return dict(parse_qsl(self.vid_info_raw))
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 109, in
vid_info_raw
    self._vid_info_raw = request.get(self.vid_info_url)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\request.py", line 53, in get
    response = _execute_request(url, headers=extra_headers, timeout=timeout)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\request.py", line 37, in
_execute_request
    return urlopen(request, timeout=timeout)  # nosec
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\Users\benzh\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Any other information:

None

Leg3ndary commented 3 years ago

Ran pip install --upgrade pytube and it is up to date.

vncastanheira commented 3 years ago

Just had the same issue, first time running spotdl.

Silverarmor commented 3 years ago

Hi Team. Known pytube issue and they are working to fix it https://github.com/pytube/pytube/issues/1060

FunFreshNew commented 3 years ago

This error also occurred in the older version. I'm using 2.2.2 and the log also shows the same exact things like that, UPDATE: It got fixed after replacing the old main.py with the new one from mentioned link under this comment thanks man!

Silverarmor commented 3 years ago

@FunFreshNew Hiya - sorry but we provide no support for outdated versions of spotDL.

FunFreshNew commented 3 years ago

@FunFreshNew Hiya - sorry but we provide no support for outdated versions of spotDL.

Yea that's ok, I'm just informing that this version also has the same exact problem. also, v2.2.2 is still working until this problem existed and so far I have experienced problems in this old version sometimes have the same core problem just like the current pytube issue

Coddo-Python commented 3 years ago

@FunFreshNew Hiya - sorry but we provide no support for outdated versions of spotDL.

Yea that's ok, I'm just informing that this version also has the same exact problem. also, v2.2.2 is still working until this problem existed and so far I have experienced problems in this old version sometimes have the same core problem just like the current pytube issue

Yes we are aware about that, because it is a pytube issue, this error will appear on every version of spotDL which uses pytube (I'm pretty sure every single one)

xnetcat commented 3 years ago

I've created version that uses yt-dl to download audio, if anyone is interested here's the command to install it

pip install https://codeload.github.com/xnetcat/spotify-downloader/zip/yt-dl --force

branch: https://github.com/xnetcat/spotify-downloader/tree/yt-dl based on: https://github.com/spotDL/spotify-downloader/pull/1339

I haven't really tested it or anything, you can report errors here

FunFreshNew commented 3 years ago

I've tried to use this fix, just replace the old main.py from pytube with this code and it works for me in (spotdl 2.2.2). I haven't tested on the latest one so you guys can try to check it out.

ameliesauvy commented 3 years ago

I've tried to use this fix, just replace the old main.py from pytube with this code and it works for me in (spotdl 2.2.2). I haven't tested on the latest one so you guys can try to check it out.

Works for me, thank you !

xnetcat commented 3 years ago

1339 will replace pytube with youtube-dl

Leg3ndary commented 3 years ago

I've created version that uses yt-dl to download audio, if anyone is interested here's the command to install it

pip install https://codeload.github.com/xnetcat/spotify-downloader/zip/yt-dl --force

branch: https://github.com/xnetcat/spotify-downloader/tree/yt-dl based on: #1339

I haven't really tested it or anything, you can report errors here

Above should fix it fine.

If you would like to wait, I believe pytubes already fixed this here https://github.com/pytube/pytube/issues/1060

xnetcat commented 3 years ago

Reopening since issue is not yet resolved, new pytube version is not yet released nor is spotdl.

and afaik new pytube version will require to sign into youtube, so this is one of the reasons to replace pytube with yt-dl image

xnetcat commented 3 years ago

fixed in v3.7.0 - #1339