Reputation: 5167
Original
I am trying to get top 10 videos in my channel from YouTube, so I followed the sample code from Google: https://developers.google.com/youtube/analytics/v1/code_samples/python#retrieve_top_10_videos_by_viewcount
I have installed all packages and downloaded client secrets. I typed python get_json.py
in command line. (The sample script is renamed to get_json.py
) This is what is showing up in command line:
WARNING:root:This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyt-analytics.readonly&
redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=849986408789-otj3v9ghdlrr24nag9c4bepei6fo0vvm.apps.googleusercontent.com&access_type=offline
If your browser is on a different machine then exit and re-run this application with the command-line parameter
--noauth_local_webserver
Then my browser pops up and I am getting this invalid_client error. Did I miss anything?
Update
I added a name in "product name" in Google API Console and reset my client secret. It works now.
Upvotes: 0
Views: 627
Reputation: 12877
It seems like you set your credentials in Google Developer Console wrong. If you are running it from a local machine, you should pick "installed application" or if from a webserver, you should specify the redirect_uri.
Also make sure YT Analytics API is turned on in the console for this project.
Upvotes: 1