在 youtube api v3 (Android) 中使用视频 ID 获取视频标题 [英] Getting video title using video id in youtube api v3 (Android)

查看:42
本文介绍了在 youtube api v3 (Android) 中使用视频 ID 获取视频标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to get youtube video details using the video id in youtube api v3. Using this 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 密钥是我在谷歌开发者控制台中使用我的 SHA1 代码注册应用程序后获得的密钥.如何克服这个错误?

The api key is the key is the one I got after registering the app using my SHA1 code in google developer console. How to get over this error?

推荐答案

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

you can make a service with GET method from mobile.All you need to do is to create a server key and append this key and video id with the url and get data

例如:如果您将 Volley 用于 HTTP 请求,则在 JsonOBjectRequest url 参数中应如下所示:

for example: if you are using Volley for HTTP requests then in JsonOBjectRequest url parameter should look this:

"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"

希望这会有所帮助.

这篇关于在 youtube api v3 (Android) 中使用视频 ID 获取视频标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆