是否有免费的无限 API 来获得 Youtube 音乐视频的前 100 名广告牌? [英] Is there a free unilimited API to get the top 100 billboard with Youtube music videos?
问题描述
在 http://www.youtube.com/music 上,有一个 Billboard 热门 100 名单.是否有以编程方式获取此列表的 API?
On http://www.youtube.com/music, there's a Billboard hot 100 list. Is there a API to get this list programmatically?
我知道有一个 youtube API 可以获取热门音乐视频:http://gdata.youtube.com/feeds/api/standardfeeds/most_popular_Music?v=2&max-results=50&time=this_week,但它只返回 50视频和列表不是公告牌图表.
I know there's a youtube API to get the top music videos: http://gdata.youtube.com/feeds/api/standardfeeds/most_popular_Music?v=2&max-results=50&time=this_week, however it only returns 50 videos and the list is not the Billboard chart.
还有一个公告牌前 100 名的 rss,http://www.billboard.com/rss/charts/hot-100,但它不会返回 Youtube 视频链接和缩略图.
And there's also a rss for Billboard top 100, http://www.billboard.com/rss/charts/hot-100, but it doesn't return Youtube video links and thumbnail images.
推荐答案
您可以使用分页获得结果.Jeffrey Posnick 举了一个例子来说明如何做到这一点:
You can get the result using pagination. There is an example from Jeffrey Posnick of how to do it:
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);
}
}
}
这篇关于是否有免费的无限 API 来获得 Youtube 音乐视频的前 100 名广告牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!