mps-youtube / pafy

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

Youtube error 403: Access Not Configured. YouTube Data API #255

Open AIIX opened 4 years ago

AIIX commented 4 years ago

Using Latest PyPi Version. Error: pafy.util.GdataError: Youtube Error 403: Access Not Configured. YouTube Data API has not been used in product 422897895433 before or it is disabled.

tizonia commented 4 years ago

I'm also seeing this error with Tizonia (https://github.com/tizonia/tizonia-openmax-il)

nigh8w0lf commented 4 years ago

getting this error when I try to launch mpsyt from terminal. pafy.util.GdataError: Youtube Error 403: Access Not Configured. YouTube Data API has not been used in project 422897895433 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=422897895433 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

samidten commented 4 years ago

having the same issue. tried changing api key but still no luck :(

mateuszr commented 4 years ago

According to this answer: https://stackoverflow.com/questions/40355794/access-not-configured-youtube-data-api-has-not-been-used-in-project-60894180825 if you haven't been using your API key for some time it might not work. Go and create a new application, create new API, Make sure that you add OAuth (even if you don't plan to use it) and later add Youtube API v3 to your app.

For me also the old API stopped working and the new one is now ok.

tizonia commented 4 years ago

Thanks for the responses.

I can confirm that creating a new application + new API worked for me. For some reason, a new API key created on the old application would not work.

AIIX commented 4 years ago

Is this going to be fixed in pafy pypi package or is it working only with manual intervention by registering own application and generating new api key and modifying pafy locally ?

sebma commented 4 years ago

I agree with AIIX, I don't think average users are going to be able to do that. Can you guys do it inside pafy instead ?

galgot commented 4 years ago

Can confirm its difficult (impossible) for average user to fix that. I've tried creating an new API. Tried adding the new API key to config.py, not working. Tried to go through having an authorized domain for having the OAuth ID, as I suppose this is what is required now. But still don't have it : When I fill all in "OAuth consent screen" , the "Submit for Verification" button stays greyed out. Any ideas ?

AyoungDukie commented 4 years ago

I actually was having the same problems @galgot; after some additional looking, found out that OAuth may not be necessary, and was able to fix my access without it.

That said, for reference, to add OAuth, what I realized was not only did I need a verified domain, but also had to provide a link to a privacy policy page. I do not have such a policy, so I felt stuck.

I came across the following SO post and their notes about issues persisting through regenerating keys led me to try making an entirely new project, enabling the YouTube Data API, and creating new credentials, and restricting them to the YouTube Data API (and after everything was working, I deleted the old project, just for housekeeping purposes). Knock on wood, these new api credentials have now worked for me, so maybe give that a try.

galgot commented 4 years ago

Yaw ! Worked thanks. Deleted all APIs. Created a new one with a new key. Used that one in config.py. First , it didn't work. Then removing mpsyt caches with rm ~/.config/mps-youtube/cache_py* and it worked.

ghost commented 4 years ago

For those without a google account, I found a suitable alternative to mpsyt: https://github.com/trizen/straw-viewer The original project, youtube-viewer, seems to suffer from the same issue mpsyt does, but the straw-viewer fork apparently uses invidio.us, a reduced youtube version. Works fine with me so far.

nowell-morris commented 4 years ago

for me it was an old key. I had generated by key about 9 months ago but hadn't used it for a while. So, I generated a replacement. I am using it in mpsyt, so I opened it up, ran command: set ap_key < my newest key > It worked right after that! I did not need to reset .config directory or contents. I let mpsyt handle that on its own.

brunakov commented 4 years ago

I have hardcoded my new API key to util.call_gdata() , but is there a better way on how to register my pafy app to youtube applications ?
p.s I am using pafy only for the data API not for downloading etc.

hillt03 commented 4 years ago

I have hardcoded my new API key to util.call_gdata() , but is there a better way on how to register my pafy app to youtube applications ? p.s I am using pafy only for the data API not for downloading etc.

Pafy exposes the pafy.set_api_key(key) method, unfortunately I'm still receiving this error after creating and setting my own YouTube Data API key on Windows 10 via this method.

brunakov commented 4 years ago

I have hardcoded my new API key to util.call_gdata() , but is there a better way on how to register my pafy app to youtube applications ? p.s I am using pafy only for the data API not for downloading etc.

Pafy exposes the pafy.set_api_key(key) method, unfortunately I'm still receiving this error after creating and setting my own YouTube Data API key on Windows 10 via this method.

This worked for me ! Thank you very much !

ashwinvis commented 4 years ago

How practical would be for pafy can to use Invidious API instead https://github.com/omarroth/invidious/wiki/API?

conceptrat commented 4 years ago

Yaw ! Worked thanks. Deleted all APIs. Created a new one with a new key. Used that one in config.py. First , it didn't work. Then removing mpsyt caches with rm ~/.config/mps-youtube/cache_py* and it worked.

Just for reference. You don't need to modify mps-youtube config.py just pass the API key to mps-youtube directly like so...

mpsyt set api_key YOUR_API_KEY

mps-youtube then checks if i can make a zero quota request for language support and if that works then it should've saved the APIkey and you're good to go. Quit mps-youtube and go back in and type "set" and check that it saved your API key. If you get an error saying "Invalid key or quota exceeded..." then either the API key has become invalid or you have actually exceeded your quota. Not likely for individuals unless your making lots calls searching, downloading, etc.

conceptrat commented 4 years ago

for me it was an old key. I had generated by key about 9 months ago but hadn't used it for a while. So, I generated a replacement. I am using it in mpsyt, so I opened it up, ran command: set ap_key < my newest key > It worked right after that! I did not need to reset .config directory or contents. I let mpsyt handle that on its own.

Important part is to create a new Project and not just new Credentials.