ビデオIDが指定されている場合、すべての統計を取得する方法を知っています. しかし、クエリのタイトルに基づいて検索結果 (20) のビデオ ID を取得する必要がある場合は、それを行うことができません。JAVA APIを使用して対処する方法を教えてください。
事前にどうもありがとう。
Googleドキュメントを検索しましたか?彼らのガイドにはあなたが探しているものが正確にあります:YouTubeAPI-ビデオの検索
それはあなたに例さえ与えます:
YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
// order results by the number of views (most viewed first)
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
// search for puppies and include restricted content in the search results
query.setFullTextQuery("puppy");
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
VideoFeed videoFeed = service.query(query, VideoFeed.class);
返されたVideoFeedから、ビデオIDを簡単に取得できます。
for(VideoEntry videoEntry : videoFeed.getEntries() ) {
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
mediaGroup.getVideoId(); // the video ID
}