Collect video thumbnail of youtube API

0

If I have the URL of a Youtube video.

How can I access the thumbnails of that same video?

  

Publication in English: link

    
asked by ntzz 05.11.2018 в 15:23
source

1 answer

2
  

Answer in English: link

Each YouTube video has 4 generated images. They have a predictable format in the following way:

https://img.youtube.com/vi/<youtube-video-id>/0.jpg
https://img.youtube.com/vi/<youtube-video-id>/1.jpg
https://img.youtube.com/vi/<youtube-video-id>/2.jpg
https://img.youtube.com/vi/<youtube-video-id>/3.jpg

The first one on the list will be a complete image and the others will be thumbnails. The default thumbnail (eg: 1.jpg , 2.jpg , 3.jpg ) are:

https://img.youtube.com/vi/<youtube-video-id>/default.jpg

For the high-quality version of the thumbnail use:

https://img.youtube.com/vi/<youtube-video-id>/hqdefault.jpg

There is also a medium quality thumbnail using the following URL similar to the high definition one:

https://img.youtube.com/vi/<youtube-video-id>/mqdefault.jpg

For the standard definition use:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg

For the maximum resolution of the model, use:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg

All the above URLs are available in http as well. Additionally, the name of the shortened host i3.ytimg.com or i.ytimg.com that works in the place of img.youtube.com in the previous examples.

Otherwise, you can also use the data of the YouTube API (v3) to collect the thumbnails :

    
answered by 05.11.2018 в 15:23