spotify-downloader: HTTP Error 403: Forbidden

What is the purpose of your issue?

  • Bug
  • Feature Request
  • Question
  • Other

Description

I was using spotld for a while and it worked just great. Now, when trying to download a song (using Spotify link), I’m getting “HTTP Error 403: Forbidden”. (Even if the song was successfully downloaded in the past) Unlike #246 I don’t see quota issues in the traceback.

Also, setting my own youtube-api-key in config.yml didn’t help. Getting the same error.

Log

~/D/t/spotify ❯❯❯ spotdl -s ‘https://open.spotify.com/track/2njUxZ4151DWIrfIK3loFj?si=xAnONgNZS1SH5zIQCHE27A’ -f . -ll DEBUG DEBUG: Input song is a Spotify URL DEBUG: Fetching metadata for given track URL DEBUG: Fetching lyrics DEBUG: {‘album’: {‘album_type’: ‘single’, ‘artists’: [{‘external_urls’: {‘spotify’: ‘https://open.spotify.com/artist/6qqNVTkY8uBg9cP3Jd7DAH’}, ‘href’: ‘https://api.spotify.com/v1/artists/6qqNVTkY8uBg9cP3Jd7DAH’, ‘id’: ‘6qqNVTkY8uBg9cP3Jd7DAH’, ‘name’: ‘Billie Eilish’, ‘type’: ‘artist’, ‘uri’: ‘spotify🧑‍🎨6qqNVTkY8uBg9cP3Jd7DAH’}, {‘external_urls’: {‘spotify’: ‘https://open.spotify.com/artist/586uxXMyD5ObPuzjtrzO1Q’}, ‘href’: ‘https://api.spotify.com/v1/artists/586uxXMyD5ObPuzjtrzO1Q’, ‘id’: ‘586uxXMyD5ObPuzjtrzO1Q’, ‘name’: ‘Sofi Tukker’, ‘type’: ‘artist’, ‘uri’: ‘spotify🧑‍🎨586uxXMyD5ObPuzjtrzO1Q’}], ‘external_urls’: {‘spotify’: ‘https://open.spotify.com/album/5XRJoC2QtsNbAubsCrBBbG’}, ‘href’: ‘https://api.spotify.com/v1/albums/5XRJoC2QtsNbAubsCrBBbG’, ‘id’: ‘5XRJoC2QtsNbAubsCrBBbG’, ‘images’: [{‘height’: 640, ‘url’: ‘https://i.scdn.co/image/ab67616d0000b2738fbc40da547bc157e8956cea’, ‘width’: 640}, {‘height’: 300, ‘url’: ‘https://i.scdn.co/image/ab67616d00001e028fbc40da547bc157e8956cea’, ‘width’: 300}, {‘height’: 64, ‘url’: ‘https://i.scdn.co/image/ab67616d000048518fbc40da547bc157e8956cea’, ‘width’: 64}], ‘name’: ‘COPYCAT (Sofi Tukker Remix)’, ‘release_date’: ‘2018-01-12’, ‘release_date_precision’: ‘day’, ‘total_tracks’: 1, ‘type’: ‘album’, ‘uri’: ‘spotify:album:5XRJoC2QtsNbAubsCrBBbG’}, ‘artists’: [{‘external_urls’: {‘spotify’: ‘https://open.spotify.com/artist/6qqNVTkY8uBg9cP3Jd7DAH’}, ‘href’: ‘https://api.spotify.com/v1/artists/6qqNVTkY8uBg9cP3Jd7DAH’, ‘id’: ‘6qqNVTkY8uBg9cP3Jd7DAH’, ‘name’: ‘Billie Eilish’, ‘type’: ‘artist’, ‘uri’: ‘spotify🧑‍🎨6qqNVTkY8uBg9cP3Jd7DAH’}, {‘external_urls’: {‘spotify’: ‘https://open.spotify.com/artist/586uxXMyD5ObPuzjtrzO1Q’}, ‘href’: ‘https://api.spotify.com/v1/artists/586uxXMyD5ObPuzjtrzO1Q’, ‘id’: ‘586uxXMyD5ObPuzjtrzO1Q’, ‘name’: ‘Sofi Tukker’, ‘type’: ‘artist’, ‘uri’: ‘spotify🧑‍🎨586uxXMyD5ObPuzjtrzO1Q’}], ‘copyright’: ‘© 2018 Darkroom/Interscope Records’, ‘disc_number’: 1, ‘duration’: 198.684, ‘explicit’: False, ‘external_ids’: {‘isrc’: ‘USUM71713025’}, ‘external_urls’: {‘spotify’: ‘https://open.spotify.com/track/2njUxZ4151DWIrfIK3loFj’}, ‘genre’: ‘Electropop’, ‘href’: ‘https://api.spotify.com/v1/tracks/2njUxZ4151DWIrfIK3loFj’, ‘id’: ‘2njUxZ4151DWIrfIK3loFj’, ‘is_local’: False, ‘lyrics’: None, ‘name’: ‘COPYCAT - Sofi Tukker Remix’, ‘popularity’: 71, ‘preview_url’: None, ‘publisher’: ‘Darkroom’, ‘release_date’: ‘2018-01-12’, ‘spotify_metadata’: True, ‘total_tracks’: 1, ‘track_number’: 1, ‘type’: ‘track’, ‘uri’: ‘spotify:track:2njUxZ4151DWIrfIK3loFj’, ‘year’: ‘2018’} DEBUG: Opening URL: https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=Billie Eilish - COPYCAT - Sofi Tukker Remix lyrics INFO: Billie Eilish - COPYCAT (Sofi Tukker Remix/Lyrics) (http://www.youtube.com/watch?v=lwcGLEAy5co) DEBUG: Refining songname from “Billie Eilish - COPYCAT (Sofi Tukker Remix/Lyrics)” to “Billie Eilish - COPYCAT - Sofi Tukker Remix” DEBUG: Cleaning any temp files and checking if “Billie Eilish - COPYCAT - Sofi Tukker Remix” already exists DEBUG: Downloading from URL: https://r2---sn-ivuoxu-ua8z.googlevideo.com/videoplayback?expire=1587053006&ei=bi2YXqLIM8KexN8PtLit6AM&ip=77.137.95.181&id=o-AIqaJdvL45S5aTbx_1_iqlXT1vcTdQ4AeeAKScN8QU2T&itag=140&source=youtube&requiressl=yes&mh=yj&mm=31%2C29&mn=sn-ivuoxu-ua8z%2Csn-aigzrn7l&ms=au%2Crdu&mv=m&mvi=1&pl=24&initcwndbps=803750&vprv=1&mime=audio%2Fmp4&gir=yes&clen=3235194&dur=199.854&lmt=1577505052328558&mt=1587031295&fvip=2&keepalive=yes&c=WEB&txp=6201222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ALrAebAwRQIgC57krhwgIuSbPcIsBxae8PQievpvlHH2_ICWonTFnjQCIQDmFIKeaqw5pV_lQQbwxUyEGiz8Xt91aLQCFkWUfG8pSg%3D%3D&sig=lJAJpPlAswRgIhALB1OLp4JxFjv_bvvvVf-rzHLE8Nxyo57v202F5xstKTAiEA9RCu8VVL-m2oq=PfDh8cWMqjw3Oqz3gfG_GTbnfd16&ratebypass=yes DEBUG: Saving to: ./Billie Eilish - COPYCAT - Sofi Tukker Remix.m4a Traceback (most recent call last): File “/usr/local/bin/spotdl”, line 8, in <module> sys.exit(main()) File “/usr/local/lib/python3.8/site-packages/spotdl/spotdl.py”, line 68, in main match_args() File “/usr/local/lib/python3.8/site-packages/spotdl/spotdl.py”, line 28, in match_args track_dl.download_single() File “/usr/local/lib/python3.8/site-packages/spotdl/downloader.py”, line 120, in download_single return self._download_single(songname) File “/usr/local/lib/python3.8/site-packages/spotdl/downloader.py”, line 128, in _download_single if youtube_tools.download_song(input_song, self.content): File “/usr/local/lib/python3.8/site-packages/spotdl/youtube_tools.py”, line 191, in download_song link.download(filepath=filepath) File “/usr/local/lib/python3.8/site-packages/pafy/backend_youtube_dl.py”, line 181, in download downloader.download(filepath, infodict) File “/usr/local/lib/python3.8/site-packages/youtube_dl/downloader/common.py”, line 366, in download return self.real_download(filename, info_dict) File “/usr/local/lib/python3.8/site-packages/youtube_dl/downloader/http.py”, line 341, in real_download establish_connection() File “/usr/local/lib/python3.8/site-packages/youtube_dl/downloader/http.py”, line 109, in establish_connection ctx.data = self.ydl.urlopen(request) File “/usr/local/lib/python3.8/site-packages/pafy/backend_youtube_dl.py”, line 191, in urlopen return g.opener.open(url) File “/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py”, line 531, in open response = meth(req, response) File “/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py”, line 640, in http_response response = self.parent.error( File “/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py”, line 569, in error return self._call_chain(*args) File “/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py”, line 502, in _call_chain result = func(*args) File “/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py”, line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I added clear cache command ( ydl.cache.remove()) inside the try/except of the _fetch_basic method in pafy, backend_youtube_dl.py

@kekfic That should work too but an easier way would be to do as @Amekyras mentioned:

Same for me, the 403 error for youtube-dl was fixed by passing --rm-cache-dir, is there any chance something similar is stopping spotdl from working?

So running:

$ youtube-dl --rm-cache-dir

should fix this and spotdl should work fine afterwards.

This error is from youtube-dl and since spotdl uses youtube-dl, deleting youtube-dl’s cache should fix the original issue.

First, update your install pip install -U spotdl then update youtube-dl pip install -U youtube-dl. It worked for me.

Same for me, the 403 error for youtube-dl was fixed by passing --rm-cache-dir, is there any chance something similar is stopping spotdl from working?

i suggest to add an option like youtube-dl “–no-cache-dir” and yes clear cache of youtube-dl solve this problem for me.