我正在使用 jQuery Mobile 框架开发混合/移动应用程序,我想从特定用户/ channel 检索实时事件提要(即将到来或精选)。我以这种方式尝试过:https://gdata.youtube.com/feeds/api/users/albpower2/events .
我得到了一个
Developer key required for this operation
消息。
我创建了一个开发人员 key ,但我不知道如何将其包含到此 URL API 调用中。
更新: 我为 Youtube v3 数据 API 找到了一些东西,从他们的在线 API 测试平台上它可以工作,但是当我尝试直接从浏览器执行该功能时,它说需要 OAuth 验证。我不知道如何设置 OAuth key 并从 url 中获取该功能
从这个 GET 请求 https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=all&key=AIzaSyDhDZjburmzpaoH39Uj4dnU6X_GRLbCVW0
这是回应:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
最佳答案
只需将其包含在 API 调用的 URL 中:
https://gdata.youtube.com/feeds/api/users/albpower2/events?key=YOUR_API_KEY
<子>来自 the docs .
关于javascript - 如何获取 JSON 中特定 YouTube channel 即将到来的直播事件提要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29748961/