2012-08-30 24 views
0

http://www.youtube.com/music,有一個Billboard熱100名單。有沒有一個API以編程方式獲取此列表?是否有免費的無限制API來獲得Youtube音樂視頻的前100名廣告牌?

我知道有一個YouTube音樂視頻獲取頂級音樂視頻:http://gdata.youtube.com/feeds/api/standardfeeds/most_popular_Music?v=2&max-results=50&time=this_week,但它只返回50個視頻和列表不是廣告牌圖表。

還有還有風雲榜排名前100位,http://www.billboard.com/rss/charts/hot-100一個RSS,但它不返回的Youtube視頻鏈接和縮略圖。

回答

1

您可以使用分頁得到結果。 有來自傑弗裏Posnick的如何做到這一點的例子:

https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/4sjeUOy9ojE

int count = 1; 
    boolean moreResults = true; 
    while (moreResults) { 
     for (VideoEntry videoEntry : videoFeed.getEntries()) { 
     // Do whatever you'd like with videoEntry... 
     System.out.println(videoEntry.getMediaGroup().getVideoId()); 
     } 
     if (count++ >= 10) { 
     moreResults = false; 
     } else { 
     Link nextLink = videoFeed.getNextLink(); 
     if (nextLink == null) { 
      moreResults = false; 
     } else { 
      videoFeed = service.query(new YouTubeQuery(new 
URL(nextLink.getHref())), VideoFeed.class); 
     } 
     } 
    } 
相關問題