1
我开始学习如何使用Java Youtube API,但遇到了问题。我下面由谷歌提供的教程:Youtube Java API。使YouTubeService无需登录
http://code.google.com/apis/youtube/2.0/developers_guide_java.html
的问题是,是,你似乎需要一个YouTubeService对象进行查询。这似乎是唯一的方式来做到这一点是与用户登录。我怎样才能不查询用户查询?
YouTubeService service = new YouTubeService(); //???? How do I make a proper YouTubeService without login. There is no constructor without and parameters.
String search = "Dubstep";
try {
YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
query.setOrderBy(YouTubeQuery.OrderBy.RELEVANCE);
query.setFullTextQuery(search);
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
VideoFeed videoFeed = service.query(query, VideoFeed.class);
printVideoFeed(videoFeed, true); // Eclipse also doesn't recognize this method.
} catch (MalformedURLException e) {
e.printStackTrace();
}
我真的这个困惑,我真的需要这种帮助。
谢谢!