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

Error 403 Daily Limit Exceeded #551

Closed
jdsampayo opened this issue Oct 23, 2016 · 35 comments
Closed

Error 403 Daily Limit Exceeded #551

jdsampayo opened this issue Oct 23, 2016 · 35 comments

Comments

@jdsampayo
Copy link

jdsampayo commented Oct 23, 2016

I'm getting the following error trying to search:

Error 403 Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/translate/quotas?project=655912152876

I use mps-youtube almost daily at my cafe and it is the first time I get it,

Tried to search a similar bug but didn't found anything about it.

@ids1024
Copy link
Contributor

ids1024 commented Oct 23, 2016

The quota affects all mpsyt users; API keys for the youtube api have a quota on requests/day.

As far as I am aware this is the first time the quota has been reached for mpsyt. I don't know if this is going to start being a regular problem...

You can also get your own api key and use it in mpsyt with set api_key API_KEY.

@jdsampayo
Copy link
Author

Thanks Rahul!!

Will give it a try :)

2016-11-17 1:04 GMT-06:00 Rahul Roshan notifications@github.com:

Create your own API key for youtube data API.

edit file, /usr/local/lib/python3.5/site-packages/mps_youtube/config.py
and paste it here:
ConfigItem("api_key", "AIzaSyD1UBJcVMf2jdmlgRURDW6zN4zxxxxxxxx",
check_fn=check_api_key)

Worked for me.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#551 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABAu4zsA2wLel1XHQiWaQw8cVTdp3TkTks5q-_yEgaJpZM4KeCmV
.

@oexar
Copy link

oexar commented Nov 18, 2016

Same issue here.

@ids1024
Copy link
Contributor

ids1024 commented Nov 18, 2016

Yeah, this has clearly become an issue, though I don't know what can be done about it.

As mentioned above, people can get their own API keys from Google so they are not subject to the quota of the shared key.

@oexar
Copy link

oexar commented Nov 18, 2016

I'm using it through a public VPN and after connecting to another server, it's working again.

Also sometimes I can see the error but after a retry it works (without changing the connection).. so the problem appears to be random, and not linked to the API key.

@jdsampayo
Copy link
Author

For some reason Rahul Roshan response was not posted on GitHub, just email, I quote him to have it as reference:

Create your own API key for youtube data API.

edit file, /usr/local/lib/python3.5/site-packages/mps_youtube/config.py
and paste it here:
ConfigItem("api_key", "AIzaSyD1UBJcVMf2jdmlgRURDW6zN4zxxxxxxxx",
check_fn=check_api_key)

Worked for me.

@ids1024
Copy link
Contributor

ids1024 commented Nov 19, 2016

@jdsampayo That's not the right way to do it. Just run set api_key API_KEY in mpsyt. You don't need to modify any source files.

@rahulroshan96
Copy link

Create your own API key for youtube data API.

edit file, /usr/local/lib/python3.5/site-packages/mps_youtube/config.py
and paste it here:
ConfigItem("api_key", "AIzaSyD1UBJcVMf2jdmlgRURDW6zN4zxxxxxxxx",
check_fn=check_api_key)

Worked for me.

@lol768
Copy link
Contributor

lol768 commented Nov 20, 2016

@rahulroshan96 What's with the comment copy-paste?

@tinydynamite00
Copy link

Ran into this issue again briefly after light mpsyt usage earlier today - mostly experimenting with config settings. I'm using mpsyt on Android 7.0 via Termux and was able to launch it successfully with the default API key after running rm ~/.config/mps-youtube/cache_py_3.5.2.

@jdsampayo
Copy link
Author

I ran into this today also,

I resolved it, creating my own app in google and setting my API key with set api_key API_KEY

You need to restart mps-yt in order to load the new key.

This is my key: AIzaSyC0tF7MUWtVaGEnxQWOOjHSGA_Ty_nE9go

@kudo-shinichi
Copy link

Happened with for the first time today. Here is how I got it working:

  1. Edit the config.py file placed in /usr/lib/python3.7/site-packages/mps_youtube/.
  2. Find the line ConfigItem("api_key", "AIza.......".
  3. Change the API key, either use the one provided by jdsampayo or generate one for yourself from google developer using this help page, https://www.slickremix.com/docs/get-api-key-for-youtube/#

It began to work after I followed the above steps.

@WloHu
Copy link

WloHu commented Jul 8, 2019

It didn't work for me. I had to remove "~/.config/mps-youtube/config" to force mpsyt to use new API key added to config file in "site-packages".

Really. Why this API key is hardcoded anyways? Why configuration file is not plain text? Why API key can't be updated from inside the program? It smells like spaghetti.

@dt-rush
Copy link
Contributor

dt-rush commented Jul 15, 2019

I have just pushed a PR which changes the config format to JSON, so that users can more easily edit the API key: #998

@ids1024
Copy link
Contributor

ids1024 commented Jul 15, 2019

Really. Why this API key is hardcoded anyways? Why configuration file is not plain text? Why API key can't be updated from inside the program?.

It actually can. The ConfigItem just has the default value. The set command has an apk_key setting.

@WloHu
Copy link

WloHu commented Jul 15, 2019

@ids1024 IKR The point is that I couldn't do that with default API key which has exceeded the daily request limit; read: made program to stop working to the point that I couldn't change ANY settings. In such case I could either wait until limit is reset or fiddle in application code.

@TsukiZombina
Copy link

TsukiZombina commented Jul 19, 2019

I have tried changing my API Key using set api_key command, it shows:

Invalid key or quota exceeded, 'AIzaSyxxxxxxxxxxxxxxxxxxxx'

I also tried modifying ConfigItem("api_key", "AIzaSyxxxxxxxxxxxxxxxxxxxx",
check_fn=check_api_key), but it doesn't work, it keeps the old API Key.

Recently I tried modifying ~/.config/mps-youtube/config or ~/.config/mps-youtube/config.json, both manage to change the old API Key but I still have an error:

Error fetching data. Possible network issue.
Youtube Error 403: Access Not Configured. YouTube Data API has not been used in project 317200005330 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=317200005330 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

I deleted ~/.config/mps-youtube folder as proposed by @kkkrist in #978 but it doesn't worked for me.

I have tried with different APIs, even with @jdsampayo's, used the help page that @kudo-shinichi referred and every time I restarted mps-youtube. Any help?

@dt-rush
Copy link
Contributor

dt-rush commented Jul 20, 2019

@TsukiZombina if you check the error message, it's because you're using an API key which does not have its access configured. Each key belongs to someone's google account - the one that ships with this code by default happens to belong to the main dev. The one you clicked on has either not been activated, or has been turned off.

If you want to bypass the issue, you should set up your own API key, at http://console.cloud.google.com:

  1. create a project
  2. then go to the YouTube Data API v3 page: https://console.cloud.google.com/apis/api/youtube.googleapis.com/overview
  3. enable the API
  4. it should then guide you through the steps to get an API key

This is a real chore, and I wish the main dev would look into getting a paid account or something and supporting the costs with a transparent donation system, so that by default mps-youtube just works and there isn't this strange free quota issue.

At any rate, here's mine for convenience, since I doubt enough people will see this page to bust my free quota:

"AIzaSyA1n8CiAdiEleM3CCLhhSA6w27xjj-6LIs"

ALSO NOTE that every time you run mps-youtube, it will:

  1. check if there is a config file and use the value there if possible
  2. if not, it will save the value in python3.5/site-packages/mps_youtube/config.py to the config file, creating it

So:

  • if you installed by cloning from source on the develop branch, which has my changes merged, in which config.json is used, you can edit the config.json file by hand (this is only if you cloned from source in the last 5 days, since the most recent release was in February of 2018)
  • otherwise you're running a version which uses a weird binary format for the config file, which is annoying and fiddly to edit by hand, so you should delete the config file and edit python3.5/site-packages/mps_youtube/config.py each time you want to try a new key.

@jdsampayo
Copy link
Author

@TsukiZombina I suggest you create your own key following the steps of @dt-rush if you need help let us know.

I received this email from Google:

Captura de Pantalla 2019-07-20 a la(s) 14 14 23

Captura de Pantalla 2019-07-20 a la(s) 14 14 59

When I checked the console it was always at 99.9% usage, so I regenerated the key to avoid that google removes my access.

As they key is free, I highly advise you generate your own so you don't have the problems of usage.

Sorry about the inconveniences,

Best regards,

@TsukiZombina
Copy link

Thanks @jdsampayo, I have created and used my own API key before, it has no restrictions and the Youtube Data API enabled and made another restricted just for use in mps-youtube application. I also tried using the one that @dt-rush provided, but all still show the same error.

@dt-rush
Copy link
Contributor

dt-rush commented Jul 21, 2019

@TsukiZombina are you sure you're deleting the config file? It will use the old API keys if you haven't deleted the config file, regardless of what you put in the source code.

Another idea: clone the develop branch which has my PR, remove your existing install, and then from inside the source dir, run python3 setup.py install. This will install a version which uses JSON format for the config file, making it easy to make sure your config is using the intended key.

If after all that, you still see the error, I'm not sure what to say. I know that when I configured my own key, it was sending the error you saw, about how the API is not enabled, for about 10 minutes after I enabled it, as it takes some time to propagate inside google's network. Maybe that's why you saw that error?

@kkkrist
Copy link

kkkrist commented Jul 21, 2019

Are you sure your mpsyt version uses a youtube-dl newer it equal to 2019.06.21? Could you post the output of mpsyt --version please?

@TsukiZombina
Copy link

This is @kkkrist:

mpsyt version : 0.2.8
notes : released 17 February 2018
pafy version : 0.5.4 (youtube-dl backend)
youtube-dl version : 2019.07.16
Python version : 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0]
Processor : x86_64
Machine type : x86_64
Architecture : 64bit, ELF
Platform : Linux-5.0.0-20-generic-x86_64-with-Ubuntu-19.04-disco
sys.stdout.enc : UTF-8
default enc : utf-8
Config dir : ~/.config/mps-youtube
env:TERM : xterm-256color
env:SHELL : /bin/zsh
env:LANG : en_US.UTF-8
env:LANGUAGE : en_US

@dt-rush I did that, I deleted the config file and after seeing that the json was added I updated my mps-youtube with thedevelop branch and modify the json to change the key, it succesfully changed the key but showing the error that I mentioned before. I also tried the same uninstalling and reinstalling from source.

@Sophira
Copy link

Sophira commented Jul 30, 2019

I'm a little confused about this bug, because despite setting my own API key yesterday (and verified that it's getting used), today I'm getting this quota error despite that the usage on the key is nowhere near the quota. Even more tellingly, it's the exact same error as given in issue #567, right down to the project number in the URL:

pafy.util.GdataError: Youtube Error 403: Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=422897895433

422897895433 is the same project number that this original poster of issue #567 noted. And I promise that I did set my own API key and it has seen usage - I can verify that in my dashboard.

It seems like there are cases when the built-in API key is being used even when a custom API key is set?

@Sophira
Copy link

Sophira commented Jul 30, 2019

I'm using mpsyt 0.2.8, by the way. Sorry for not mentioning that.

@Sophira
Copy link

Sophira commented Jul 30, 2019

After noticing that 0.2.8 was released quite some time ago, I installed the latest Git checkout instead - but I'm still getting that error. (Sorry, I can't edit comments on this browser.)

@PeterFajner
Copy link

Setting the API key and deleting ~/.config/mps-youtube/config didn't work for me, but this workaround did.

Open up util.py, which is in one of these locations (or a similar one) depending on how you installed mps-youtube:

  • ~/.local/lib/python3.6/site-packages/pafy/util.py
  • ~/.local/lib/python3.7/site-packages/pafy/util.py
  • /usr/lib/python3.6/site-packages/pafy/util.py

And change qs['key'] = g.api_key to qs['key'] = 'yourapikey'

@Sophira
Copy link

Sophira commented Aug 3, 2019

Ah, thank you!

I'd submit this as an issue, but the GitHub doesn't appear to exist any more: https://github.com/np1/pafy/ . Their homepage doesn't work either: https://np1.github.io/pafy/ .

I suspect a patch won't be forthcoming. Is it worth forking it into mps-youtube? Or even re-implementing its functions?

@lol768
Copy link
Contributor

lol768 commented Aug 3, 2019

I'd submit this as an issue, but the GitHub doesn't appear to exist any more: https://github.com/np1/pafy/ . Their homepage doesn't work either: https://np1.github.io/pafy/ .

https://github.com/mps-youtube/pafy/

It was all moved into an org a while ago.

@humancomputerintegration

Same here only edditing pafy/g.py changed. Sounds like the culprit is the fact that check_api_key() called from config.py is actually calling pafy.set_api_key(Config.API_KEY.get), so it doesn't matter what key is actually in Config.key because it will go get it at paf.

question for y'all: Is this an actual bug or intended?

@AyoungDukie
Copy link

#1063

@83h3m07
Copy link

83h3m07 commented Mar 18, 2020

set api_key AIzaSyAoy3pYe_wQravVIa-S5tB0fySC0L06vug

@tomsaleeba
Copy link

TL;DR: check your daily quota. If it's set to 0, it means the project cannot access Youtube, even if the API is enabled.

If you have a GCP project, with the Youtube data API enabled and a key generated but still get this message, it might be because the project has been blocked/banned from Youtube. I had a project from a year ago, with a key that worked back then. Using that key now gives me this error message when trying to set api_key .... Generating new keys didn't work. Disabling/enabling the Youtube API didn't work.

In the end I deleted the project, created a new one and it worked 😯 . Thanks to https://stackoverflow.com/a/59662005/1410035 for the tip.

@arielnmz
Copy link

I just created a google project and added the youtube data api, created a key and... 10 mins later I'm over the 10,000 requests quota limit? wtf? does it count every buffer fill as a request or what?

@cjbarroso
Copy link

I just created a google project and added the youtube data api, created a key and... 10 mins later I'm over the 10,000 requests quota limit? wtf? does it count every buffer fill as a request or what?

I just created a new project, used it a while and have still not reached 50 requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests