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();
}
我真的這個困惑,我真的需要這種幫助。
謝謝!