2
votes

With the YouTube Data API, I can retrieve a list of thumbnail images for a video resource. This request...

GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=DUM1284TqFc&fields=items%2Fsnippet%2Fthumbnails&key={YOUR_API_KEY}

...generates this response...

{
 "items": [
  {
   "snippet": {
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/DUM1284TqFc/default.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/DUM1284TqFc/mqdefault.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/DUM1284TqFc/hqdefault.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/DUM1284TqFc/sddefault.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/DUM1284TqFc/maxresdefault.jpg",
      "width": 1280,
      "height": 720
     }
    }
   }
  }
 ]
}

(API Explorer)

The maxres object has a width and height of 1280 and 720. However, the url (https://i.ytimg.com/vi/DUM1284TqFc/maxresdefault.jpg) actually points to a 1920x1080 image.

It seems that the "maxres" thumbnail is generated with the same size as the original uploaded video, and the size of this particular video (https://youtu.be/DUM1284TqFc) was 1920x1080.

I cannot find a 1280x720 thumbnail image for this video.

  1. What do the width and height properties refer to?
  2. How do I get the real width and height of the thumbnail images with the YouTube Data API?
  3. Is there a 1280x720 version of the thumbnail image?
1

1 Answers

0
votes

This appears to be a bug in YouTube's API. According to the documentation, the maxres thumbnail corresponds to:

The highest resolution version of the thumbnail image. This image size is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 1280px wide and 720px tall.