How to retrieve youtube thumbnails using Google API Client Library for Java

狂风中的少年 提交于 2019-12-22 06:32:04

问题


I would be obliged, if you could kindly let me know the means by which I can retrieve the youtube thumbnails using Google API Client Library for Java, similar to the way in which we fetched thumbnails using gdata.

List<String> thumbnails = new LinkedList<String>();
for (MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
    thumbnails.add(mediaThumbnail.getUrl());
}

Looking forward, Regards, Rony


回答1:


Using the example URL from the reference page:

URL: http://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2&alt=jsonc

we can extract an example of one of the relevant pieces of JSON:

"thumbnail": {
    "sqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/default.jpg",
    "hqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/hqdefault.jpg"
}

You can modify the sample classes to parse the thumbnail object.



来源:https://stackoverflow.com/questions/3803495/how-to-retrieve-youtube-thumbnails-using-google-api-client-library-for-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!