android - Youtube 请求被阻止

标签 android youtube-api android-youtube-api

我想使用我创建的 Android Youtube API 谷歌控制台中的 API key 并将其添加到我的项目中。 现在,当我执行 Youtube 查询时,我收到以下消息:

04-25 16:41:05.899: W/System.err(7213): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
04-25 16:41:05.900: W/System.err(7213): {
04-25 16:41:05.900: W/System.err(7213):   "code" : 403,
04-25 16:41:05.900: W/System.err(7213):   "errors" : [ {
04-25 16:41:05.900: W/System.err(7213):     "domain" : "usageLimits",
04-25 16:41:05.900: W/System.err(7213):     "message" : "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
04-25 16:41:05.900: W/System.err(7213):     "reason" : "ipRefererBlocked",
04-25 16:41:05.900: W/System.err(7213):     "extendedHelp" : "https://console.developers.google.com"
04-25 16:41:05.900: W/System.err(7213):   } ],
04-25 16:41:05.900: W/System.err(7213):   "message" : "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
04-25 16:41:05.900: W/System.err(7213): }

我还需要做什么才能让 google 不阻止我的请求?要求 每个用户的限制是每天 3000 个,我用了 0 个。

最佳答案

在您的 Google 开发人员仪表板中,点击凭据并查看您的 API key 是通过引荐来源网址还是通过 IP 设置的。如果它是有限的,请确保它与您的引荐来源网址或 IP 匹配。

Public API access

关于android - Youtube 请求被阻止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29866650/

相关文章:

java - 如何从数组列表中删除单击按钮时的 ListView 项目?

javascript - YouTube iframe api 未捕获类型错误 : object is not a function?

android - 从后台恢复 Activity 后以编程方式播放/暂停 YoutubePlayer

android - com.google.android.gms.auth.GoogleAuthException : UNREGISTERED_ON_API_CONSOLE

google-apps-script - YouTube API v3 - 确定用户是否观看了视频?

android - YouTube Player Api 重新加载视频从开始切换到全屏

android - 如何防止actionMode和工具栏在它们之间切换时变为 "jump"?

java - RecyclerView onItemClickListener

java - AlertDialog 不会关闭

java - youtube api 显示 channel 视频 android