I need to display the YouTube's video thumbnail image for every video searched or featured. I just need the syntax and method to implement it in my java swing application.
Asked
Active
Viewed 1,115 times
2 Answers
3
You can load the thumbnails directly via web request. Take a look at How do I get a YouTube video thumbnail from the YouTube API?
EDIT
Here are some sample links:
https://img.youtube.com/vi/<video-id>/default.jpg
https://img.youtube.com/vi/<video-id>/hqdefault.jpg
- or -
https://img.youtube.com/vi/<video-id>/maxresdefault.jpg

Florian Berger
- 329
- 3
- 18
-
1While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/18746587) – Egon Feb 07 '18 at 09:08
-
1You are right. I just edited the answer and added some sample links. Thanks for the hint. – Florian Berger Feb 07 '18 at 15:42
0
Assuming you get the SearchListResponse
from youtube v3 data api. Now you can easily fetch the thumb url using following code.
SearchListResponse response = // data fetched from yt data api.
java.util.List<SearchResult> searchResultList = response.getItems();
for (SearchResult sr : searchResultList) {
String thumburl = sr.getSnippet().getThumbnails().getDefault().getUrl();
//for high resolution you can use: sr.getSnippet().getThumbnails().getHigh().getUrl();
}
related links. https://developers.google.com/youtube/v3/docs/search/list

MD Ruhul Amin
- 4,386
- 1
- 22
- 37