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

pafy.util.GdataError: Youtube Error 403: Access Not Configured. #671

Closed ritiek closed 4 years ago

ritiek commented 4 years ago

What is the purpose of your issue?

Description

It seems like YouTube has lately messed with API keys and newer video uploads no longer download properly and instead raise an error. See log.

Log

$ spotdl -s "https://www.youtube.com/watch?v=367XrMBcb54" ```bash $ spotdl -s "https://www.youtube.com/watch?v=367XrMBcb54" INFO: Track not found on Spotify, falling back on YouTube metadata Traceback (most recent call last): File "/home/ritiek/.local/lib/python3.6/site-packages/pafy/util.py", line 34, in call_gdata data = g.opener.open(url).read().decode('utf-8') File "/usr/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(*args) File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ritiek/.local/bin/spotdl", line 8, in sys.exit(main()) File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/spotdl.py", line 68, in main match_args() File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/spotdl.py", line 27, in match_args track_dl = downloader.Downloader(raw_song=track) File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/downloader.py", line 98, in __init__ self.content, self.meta_tags = youtube_tools.match_video_and_metadata(raw_song) File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/youtube_tools.py", line 77, in match_video_and_metadata meta_tags = fallback_metadata(meta_tags) File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/youtube_tools.py", line 68, in fallback_metadata meta_tags = generate_metadata(content) File "/home/ritiek/.local/lib/python3.6/site-packages/spotdl/youtube_tools.py", line 112, in generate_metadata "year": content.published.split("-")[0], File "/home/ritiek/.local/lib/python3.6/site-packages/pafy/backend_shared.py", line 308, in published self._fetch_gdata() File "/home/ritiek/.local/lib/python3.6/site-packages/pafy/backend_youtube_dl.py", line 68, in _fetch_gdata item = self._get_video_gdata(self.videoid)['items'][0] File "/home/ritiek/.local/lib/python3.6/site-packages/pafy/backend_shared.py", line 125, in _get_video_gdata gdata = call_gdata('videos', query) File "/home/ritiek/.local/lib/python3.6/site-packages/pafy/util.py", line 42, in call_gdata raise GdataError(errmsg) pafy.util.GdataError: Youtube Error 403: Access Not Configured. YouTube Data API has not been used in project 54427295932 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=54427295932 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. ```

Relevant issues:

ritiek commented 4 years ago

One way to fix this would be to add your own YouTube API key in config.yml.

ritiek commented 4 years ago

One way to fix this would be to add your own YouTube API key in config.yml.

Otherwise #672 (with #674 as follow-up) will skip API specific metadata.