有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Android如何使用Youtube数据API检索特定Youtube视频的JSON结果

我的url在浏览器中工作,返回查询的JSON结果,该查询获取有关Youtube视频的信息,但我不明白如何使用Youtube数据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

共 (1) 个答案