在youtube api v3(Android)中使用视频id获取视频标题

在youtube api v3(Android)中使用视频id获取视频标题,android,video,youtube,Android,Video,Youtube,我正在尝试使用youtube api v3中的视频id获取youtube视频详细信息。使用此url: https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=AIzaSyCA-EL5sT5LCQnYauNMm2Ku_PukvBcz6ms%20&part=snippet,contentDetails 我得到的回报是: { "error": { "errors": [ { "domain": "usageLim

我正在尝试使用youtube api v3中的视频id获取youtube视频详细信息。使用此url:

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密钥是我在google开发者控制台中使用我的SHA1代码注册应用程序后得到的密钥。如何克服此错误?

您可以使用手机上的get方法创建服务。您只需创建一个服务器密钥,并将此密钥和视频id附加到url并获取数据

例如:如果您对HTTP请求使用Volley,那么在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"

希望这有帮助。

您可以使用手机上的GET方法创建一个服务。您只需创建一个服务器密钥,并将该密钥和视频id附加到url并获取数据

例如:如果您对HTTP请求使用Volley,那么在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"
希望这有帮助。

这只是因为您尚未清除Console密钥中的安全限制。。 试试这些步骤

步骤1:- 转到您的项目并单击凭据。。 ()

步骤2:-生成API密钥并单击API密钥

第三步:-单击“无限制”并享受..

这只是因为您尚未清除Console密钥中的安全限制。。 试试这些步骤

步骤1:- 转到您的项目并单击凭据。。 ()

步骤2:-生成API密钥并单击API密钥

第三步:-点击“无限制”即可享受