从YouTube数据API v3的Andr​​oid应用程序获取YouTube的playlistId [英] Get a YouTube playlistId in Android app from YouTube Data API v3

查看:205
本文介绍了从YouTube数据API v3的Andr​​oid应用程序获取YouTube的playlistId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做什么,我认为将是在Android应用程序一个简单的任务。我希望能够启动一个YouTube播放列表播放,像这样的:

I am trying to do what I thought would be a simple task in an Android application. I want to be able to start playback of a YouTube playlist, like this:

 String PLAYLIST_ID = "PLF3DFB800F05F551A";
 Intent intent = YouTubeIntents.createPlayPlaylistIntent(MainActivity.context, PLAYLIST_ID);
 startActivity(intent);

显然不好受codeD playlistId 是行不通的。我希望能够与用户的播放列表的YouTube数据API查询和使用这些标识之一。我已经登记自己的应用程序中使用这些说明,我有什么,我相信是一个有效的API密钥,因为它与YouTube播放器的示例应用程序的工作原理。该安装程序是这里描述

Obviously having a hardcoded playlistId isn't going to work. I want to be able to query with the YouTube Data API for a user's playlists and use one of those IDs. I have already registered my application using these instructions, and I have what I believe to be a valid API key, as it works with the YouTube Player sample application. The setup for that is described here.

总之,在我看来,在这一点上我应该能够做一个HTTP参数GET,并指定我与&放API密钥;关键=< key_here> 我应该能够得到一些JSON数据回,我可以通过解析。这就是我卡住了。

Anyway, it seems to me at this point I should just be able to do an HTTP GET with parameters and specify my API key with the &key=<key_here> and I should be able to get some JSON data back that I can parse through. That's where I'm stuck.

我觉得我希望得到一个收集的播放列表的,但我不知道怎么办。我已经试过是一个HTTP GET这个网址:

I think I want to get a collection of playlists, but I don't know how. What I've tried is an HTTP GET to this URL:

 https://www.googleapis.com/youtube/v3/playlists?part=id&key=<MY_API_KEY>

但我只是得到

{
    "error": {
     "errors": [
      {
       "domain": "usageLimits",
       "reason": "accessNotConfigured",
       "message": "Access Not Configured"
      }
     ],
     "code": 403,
     "message": "Access Not Configured"
    }
}

我知道我的API密钥是有效的,因为它与我上面提到的示例应用程序的工作原理。还有什么其他的配置需要能够使用 YouTube数据API 来开始查询?对我来说,谷歌文档,因为这是所有的地方。我必须做一些与OAuth的?

I know my API key is valid because it works with the sample application I mentioned above. What other configuration is needed to be able to start to query using the YouTube Data API? To me, the Google documentation for this is all over the place. Do I have to do something with OAuth?

我如何得到我的Andr​​oid应用程序使用YouTube数据API通过HTTP能够开始做简单的调用?

How do I get my Android application to be able to start making simple calls via HTTP using the YouTube Data API?

推荐答案

了YouTube Direct精简版的Android的会给你一个好主意。

开发控制台与Android的YouTube播放器来播放,您应该设置简单API访问为Android,使用Data API,你应该启用安装的应用程序作为Android系统。

in Dev Console to play with Android YouTube player you should setup "Simple API access" for Android, to use Data API you should enable "installed application" as Android.

这篇关于从YouTube数据API v3的Andr​​oid应用程序获取YouTube的playlistId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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