Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get images for a youtube video of all size for a youtube channel?

Tags:

youtube

image

I want to get all of the different images that YouTube stores for all of my videos from my channel Guitar3covers

For a certain video https://www.youtube.com/watch?v=I03uuxgpWd8 the video id is: "I03uuxgpWd8". I can get the same image from both http://img.youtube.com/vi/I03uuxgpWd8/0.jpg and http://img.youtube.com/vi/I03uuxgpWd8/hqdefault.jpg. I want to get all the images stored by YouTube.

like image 573
Himanshu Pathak Avatar asked Dec 24 '22 18:12

Himanshu Pathak


1 Answers

There are actually only 4 different images which is why you are getting the same image. Most are various sizes of 0.jpg, except for 1.jpg, 2.jpg and 3.jpg which are screen caps from different stages of the video.

For reference, YouTube stores 9 thumbnails for each video:

http://img.youtube.com/vi/I03uuxgpWd8/0.jpg (480x360px) http://img.youtube.com/vi/I03uuxgpWd8/1.jpg (120x90px) http://img.youtube.com/vi/I03uuxgpWd8/2.jpg (120x90px) http://img.youtube.com/vi/I03uuxgpWd8/3.jpg (120x90px) http://img.youtube.com/vi/I03uuxgpWd8/maxresdefault.jpg (1920x1080px) http://img.youtube.com/vi/I03uuxgpWd8/sddefault.jpg (640x480px) http://img.youtube.com/vi/I03uuxgpWd8/hqdefault.jpg (480x360px) http://img.youtube.com/vi/I03uuxgpWd8/mqdefault.jpg (320x180px) http://img.youtube.com/vi/I03uuxgpWd8/default.jpg (120x90px)

Just replace the video ID (I03uuxgpWd8) for each video. Note that if the video quality is less than the quality of the thumbnail, YouTube will not store an image for that size, so you may need to check for nulls.

like image 153
08Dc91wk Avatar answered Dec 28 '22 05:12

08Dc91wk