Python 来自YouTube Analytics API的客户端错误无效

Python 来自YouTube Analytics API的客户端错误无效,python,youtube-api,youtube-data-api,youtube-analytics,Python,Youtube Api,Youtube Data Api,Youtube Analytics,原创 我正试图从YouTube上获取频道中的前十名视频,因此我遵循了谷歌的示例代码: 我已经安装了所有软件包并下载了客户端机密。我在命令行中键入了python get_json.py。(示例脚本重命名为get_json.py)这就是命令行中显示的内容: WARNING:root:This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed

原创

我正试图从YouTube上获取频道中的前十名视频,因此我遵循了谷歌的示例代码:

我已经安装了所有软件包并下载了客户端机密。我在命令行中键入了
python get_json.py
。(示例脚本重命名为
get_json.py
)这就是命令行中显示的内容:

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
然后我的浏览器弹出,我得到这个无效的客户端错误。我错过什么了吗


更新


我在谷歌API控制台的“产品名称”中添加了一个名称,并重置了我的客户机密码。它现在可以工作了。

看起来您在Google开发者控制台中设置的凭据是错误的。如果您是从本地计算机上运行它,则应选择“已安装的应用程序”,如果是从Web服务器上运行,则应指定重定向uri

另外,请确保此项目的控制台中已打开YT Analytics API