【发布时间】:2016-03-03 08:36:59
【问题描述】:
我的 url 在浏览器中工作,它返回查询的 JSON 结果,获取有关 Youtube 视频的信息,但不明白如何使用 Youtube Data API 来传递此 JSON 并查看信息。
这是我正在使用的代码:
YouTubeService service = new YouTubeService("app");
//service.setUserCredentials("xxx","xxxxxx");
String videoEntryUrl = String.format("https://www.googleapis.com/youtube/v3/videos?key=%s&part=snippet&id=%s"
, Config.YOUTUBE_API_KEY , (String) params[0]);
VideoEntry videoEntry = service.g.getEntry(new URL(videoEntryUrl), VideoEntry.class);
我创建的 API 密钥是浏览器密钥,因此数据格式为 JSON。
我收到的错误是:
com.google.gdata.util.ParseException: Unrecognized content type:application/json;charset=UTF-8
【问题讨论】:
标签: java android youtube-api