Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 4 tasks
ritiek opened this issue Mar 2, 2020 · 2 comments · Fixed by #672
Closed
1 of 4 tasks

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

ritiek opened this issue Mar 2, 2020 · 2 comments · Fixed by #672
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@ritiek
Copy link
Member

ritiek commented Mar 2, 2020

What is the purpose of your issue?

  • Bug
  • Feature Request
  • Question
  • Other

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"
$ 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 <module>
    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 ritiek added the Bug Unexpected problem or unintended behavior that needs to be fixed label Mar 2, 2020
@ritiek
Copy link
Member Author

ritiek commented Mar 2, 2020

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

ritiek added a commit that referenced this issue Mar 2, 2020
This happens because YouTube recently disabled older API keys for some
reason, and so the API key being used internally in Pafy no longer
works.

See #671 for more information.
@ritiek
Copy link
Member Author

ritiek commented Mar 2, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant