【问题标题】:Getting video title using video id in youtube api v3 (Android)在 youtube api v3 (Android) 中使用视频 ID 获取视频标题
【发布时间】:2016-10-31 23:24:32
【问题描述】:

我正在尝试使用 youtube api v3 中的视频 ID 获取 youtube 视频详细信息。使用这个网址:

https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=AIzaSyCA-EL5sT5LCQnYauNMm2Ku_PukvBcz6ms%20&part=snippet,contentDetails

我得到了回报:

{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The Android package name and signing-certificate fingerprint, null and null, do not match the app restrictions configured on your API key. Please use the API Console to update your key restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=861763996907"
}
],
"code": 403,
"message": "The Android package name and signing-certificate fingerprint, null and null, do not match the app restrictions configured on your API key. Please use the API Console to update your key restrictions."
}
}

api 密钥是我在谷歌开发者控制台中使用我的 SHA1 代码注册应用程序后得到的密钥。如何克服这个错误?

【问题讨论】:

    标签: android video youtube


    【解决方案1】:

    您可以使用手机的 GET 方法创建服务。您需要做的就是创建一个服务器密钥并将此密钥和视频 ID 附加到 url 并获取数据

    例如:如果您使用 Volley 进行 HTTP 请求,那么在 JsonOBjectRequest url 参数中应该如下所示:

    "https://www.googleapis.com/youtube/v3/videos?id=F4HuIqwGuBU&key=YOUR_SERVER_KEY&fields=items(id,snippet(description,channelId,title,categoryId),statistics)&part=snippet,statistics"
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      enter image description here

      这只是因为您没有清除控制台密钥的安全限制.. 试试这些步骤

      第 1 步:- 转到您的项目并单击凭据.. (https://console.developers.google.com/apis/credentials/key/216?project=)

      第 2 步:生成 API 密钥并点击 API 密钥

      第 3 步:- 点击无限制并享受 ..

      【讨论】:

        猜你喜欢
        • 2016-01-21
        • 2018-06-28
        • 2018-01-30
        • 2013-04-13
        • 2015-08-29
        • 2014-01-26
        • 2014-06-05
        • 2019-07-27
        • 2012-05-22
        相关资源
        最近更新 更多