How to get YouTube thumbnail dynamically?

0 votes
384 views
asked May 19, 2016 in General by Raheem
Hi, I want to get thumbnail image URL of a YouTube video dynamically using video ID. How to do this ?

1 Answer

0 votes
answered May 19, 2016 by Christian

1) You can use the Youtube API to get the thumbnails
https://developers.google.com/youtube/v3/

Sample code can be found and downloaded from here.
https://code.google.com/archive/p/youtube-api-samples/downloads

2) Or - the easy way, to link with the default generated Youtube images on Google server.
You can call it directly always. eg:

http://img.youtube.com/vi/<youtube-video-id>/default.jpg and
http://img.youtube.com/vi/<youtube-video-id>/0.jpg
– These are full size thumb images

http://img.youtube.com/vi/<youtube-video-id>/mqdefault.jpg
– – This is medium default image

http://img.youtube.com/vi/<youtube-video-id>/maxresdefault.jpg
– – This is high resolution image

http://img.youtube.com/vi/<youtube-video-id>/1.jpg – small thumb
http://img.youtube.com/vi/<youtube-video-id>/2.jpg – small thumb
http://img.youtube.com/vi/<youtube-video-id>/3.jpg
– These are small thumb images

Related questions

0 votes
1 answer 229 views
+1 vote
1 answer 34 views
0 votes
1 answer 260 views
0 votes
1 answer 372 views
+1 vote
1 answer 274 views
...