mps-youtube / pafy

Python library to download YouTube content and retrieve metadata
1.39k stars 313 forks source link

Quota limit reached? #286

Open tthn0 opened 3 years ago

tthn0 commented 3 years ago

Youtube Error 403: The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.

ipsavitsky commented 2 years ago

get your own API key, it appears that pafy's internal key always has exceeded quota

you can read how to do that here

zorgster commented 2 years ago

I received this error too and I have just started using it. If the OP was trying to call video.description and received it then that's worth double checking. I have no problems calling any other command but the description call ends with a 403 - could a malformed request lead to a 403?:

>>> print(mypaf.description)
Traceback (most recent call last):
  File "/home/user/.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 "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.6/site-packages/pafy/backend_shared.py", line 292, in description
    self._fetch_gdata()
  File "/home/user/.local/lib/python3.6/site-packages/pafy/backend_youtube_dl.py", line 69, in _fetch_gdata
    item = self._get_video_gdata(self.videoid)['items'][0]
  File "/home/user/.local/lib/python3.6/site-packages/pafy/backend_shared.py", line 125, in _get_video_gdata
    gdata = call_gdata('videos', query)
  File "/home/user/.local/lib/python3.6/site-packages/pafy/util.py", line 42, in call_gdata
    raise GdataError(errmsg)
pafy.util.GdataError: Youtube Error 403: The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.