เรากำลังอัปเดต Data API ให้สอดคล้องกับวิธีที่ YouTube นับยอดดูสำหรับ Shorts
ดูข้อมูลเพิ่มเติม
Thumbnails
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
thumbnail
ระบุขนาดรูปภาพปกต่างๆ ที่เชื่อมโยงกับทรัพยากร โปรดทราบลักษณะของภาพขนาดย่อต่อไปนี้
- พร็อพเพอร์ตี้
snippet.thumbnails
ของทรัพยากรคือออบเจ็กต์ที่ระบุรูปภาพขนาดย่อที่พร้อมใช้งานสำหรับทรัพยากรนั้น thumbnail
ทรัพยากรประกอบด้วยชุดออบเจ็กต์ ชื่อของออบเจ็กต์แต่ละรายการ (default
, medium
, high
ฯลฯ) หมายถึงขนาดรูปภาพขนาดย่อ- แหล่งข้อมูลประเภทต่างๆ อาจรองรับขนาดภาพปกที่แตกต่างกัน
- แหล่งข้อมูลประเภทต่างๆ อาจกำหนดขนาดที่แตกต่างกันสำหรับภาพปกที่มีชื่อเดียวกัน เช่น โดยปกติแล้ว
default
ภาพขนาดย่อสำหรับvideo
แหล่งข้อมูลจะมีขนาด 120x90 พิกเซล และdefault
ภาพขนาดย่อสำหรับchannel
แหล่งข้อมูลจะมีขนาด 88x88 พิกเซล - แหล่งข้อมูลประเภทเดียวกันอาจยังมีขนาดภาพขนาดย่อที่แตกต่างกันสำหรับรูปภาพบางรูป ทั้งนี้ขึ้นอยู่กับความละเอียดของรูปภาพหรือเนื้อหาต้นฉบับที่อัปโหลดไปยัง YouTube เช่น วิดีโอ HD อาจรองรับภาพปกที่มีความละเอียดสูงกว่าวิดีโอที่ไม่ใช่ HD
- ออบเจ็กต์แต่ละรายการที่มีข้อมูลเกี่ยวกับขนาดรูปภาพขนาดย่อจะมีพร็อพเพอร์ตี้
width
และพร็อพเพอร์ตี้ height
อย่างไรก็ตาม ระบบอาจไม่แสดงผลพร็อพเพอร์ตี้ความกว้างและความสูงสำหรับรูปภาพนั้น - หากรูปภาพปกที่อัปโหลดไม่ตรงกับขนาดที่กำหนด ระบบจะปรับขนาดรูปภาพให้ตรงกับขนาดที่ถูกต้องโดยไม่เปลี่ยนสัดส่วนภาพ รูปภาพไม่ได้ถูกครอบตัด แต่อาจมีแถบสีดำเพื่อให้ขนาดถูกต้อง
เมธอด
API รองรับวิธีการต่อไปนี้สำหรับทรัพยากร thumbnails
- ตั้งค่า
- อัปโหลดภาพปกวิดีโอที่ทำเองไปยัง YouTube และตั้งค่าให้วิดีโอ
การแสดงทรัพยากร
โครงสร้าง JSON ต่อไปนี้แสดงรูปแบบของทรัพยากร thumbnails
{
"default": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"medium": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"high": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"standard": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"maxres": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
}
พร็อพเพอร์ตี้
ตารางต่อไปนี้กำหนดพร็อพเพอร์ตี้ที่ปรากฏในทรัพยากรนี้
พร็อพเพอร์ตี้ |
default |
object
รูปภาพขนาดย่อเริ่มต้น ภาพปกเริ่มต้นสำหรับวิดีโอหรือแหล่งข้อมูลที่อ้างอิงถึงวิดีโอ เช่น รายการในเพลย์ลิสต์หรือผลการค้นหา มีความกว้าง 120 พิกเซลและความสูง 90 พิกเซล ภาพปกเริ่มต้นของช่องมีความกว้าง 88 พิกเซลและความสูง 88 พิกเซล |
default.url |
string
URL ของรูปภาพ |
default.width |
unsigned integer
ความกว้างของรูปภาพ |
default.height |
unsigned integer
ความสูงของรูปภาพ |
medium |
object
รูปภาพขนาดย่อเวอร์ชันที่มีความละเอียดสูงกว่า สำหรับวิดีโอ (หรือแหล่งข้อมูลที่อ้างอิงถึงวิดีโอ) รูปภาพนี้มีความกว้าง 320 พิกเซลและความสูง 180 พิกเซล สำหรับช่อง รูปภาพนี้จะมีความกว้าง 240 พิกเซลและสูง 240 พิกเซล |
medium.url |
string
URL ของรูปภาพ |
medium.width |
unsigned integer
ความกว้างของรูปภาพ |
medium.height |
unsigned integer
ความสูงของรูปภาพ |
high |
object
รูปภาพขนาดย่อเวอร์ชันความละเอียดสูง สำหรับวิดีโอ (หรือทรัพยากรที่อ้างอิงถึงวิดีโอ) รูปภาพนี้จะมีความกว้าง 480 พิกเซลและความสูง 360 พิกเซล สำหรับช่อง รูปภาพนี้จะมีความกว้าง 800 พิกเซลและความสูง 800 พิกเซล |
high.url |
string
URL ของรูปภาพ |
high.width |
unsigned integer
ความกว้างของรูปภาพ |
high.height |
unsigned integer
ความสูงของรูปภาพ |
standard |
object
รูปภาพขนาดย่อเวอร์ชันที่มีความละเอียดสูงกว่ารูปภาพความละเอียด high รูปภาพนี้พร้อมใช้งานสำหรับวิดีโอบางรายการและแหล่งข้อมูลอื่นๆ ที่อ้างอิงถึงวิดีโอ เช่น รายการในเพลย์ลิสต์หรือผลการค้นหา รูปภาพนี้กว้าง 640 พิกเซลและสูง 480 พิกเซล |
standard.url |
string
URL ของรูปภาพ |
standard.width |
unsigned integer
ความกว้างของรูปภาพ |
standard.height |
unsigned integer
ความสูงของรูปภาพ |
maxres |
object
รูปภาพขนาดย่อเวอร์ชันที่มีความละเอียดสูงสุด ขนาดรูปภาพนี้ใช้ได้กับวิดีโอบางรายการและแหล่งข้อมูลอื่นๆ ที่อ้างอิงถึงวิดีโอ เช่น รายการในเพลย์ลิสต์หรือผลการค้นหา รูปภาพนี้มีความกว้าง 1280 พิกเซลและสูง 720 พิกเซล |
maxres.url |
string
URL ของรูปภาพ |
maxres.width |
unsigned integer
ความกว้างของรูปภาพ |
maxres.height |
unsigned integer
ความสูงของรูปภาพ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-21 UTC
[null,null,["อัปเดตล่าสุด 2025-08-21 UTC"],[[["\u003cp\u003eA resource's \u003ccode\u003esnippet.thumbnails\u003c/code\u003e property contains an object, and each of these objects has properties such as \u003ccode\u003edefault\u003c/code\u003e, \u003ccode\u003emedium\u003c/code\u003e, and \u003ccode\u003ehigh\u003c/code\u003e, which identify the different available thumbnail image sizes for that specific resource.\u003c/p\u003e\n"],["\u003cp\u003eThumbnail image sizes can vary significantly between different resource types (e.g., videos vs. channels), and even among resources of the same type, based on the resolution of the original uploaded content.\u003c/p\u003e\n"],["\u003cp\u003eEach thumbnail image size object contains a \u003ccode\u003eurl\u003c/code\u003e, \u003ccode\u003ewidth\u003c/code\u003e, and \u003ccode\u003eheight\u003c/code\u003e property, but the width and height may not always be returned.\u003c/p\u003e\n"],["\u003cp\u003eWhen a custom thumbnail image is uploaded, it's resized to match the required dimensions without changing its aspect ratio, which may result in black bars being added.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ethumbnails\u003c/code\u003e resource offers various image size options, such as \u003ccode\u003edefault\u003c/code\u003e, \u003ccode\u003emedium\u003c/code\u003e, \u003ccode\u003ehigh\u003c/code\u003e, \u003ccode\u003estandard\u003c/code\u003e, and \u003ccode\u003emaxres\u003c/code\u003e, each with distinct resolutions to accommodate different display needs.\u003c/p\u003e\n"]]],["Thumbnail resources define various image sizes (`default`, `medium`, `high`, etc.) for different resource types. Image dimensions vary by resource type and resolution. The `thumbnails` resource is an object within `snippet.thumbnails` that holds size-specific objects, each with `url`, `width`, and `height` properties. The `set` method allows uploading a custom video thumbnail. When the dimensions don't match, the image is resized, maintaining its aspect ratio, with possible added black bars.\n"],null,["# Thumbnails\n\nA **thumbnail** resource identifies different thumbnail image sizes associated with a resource. Please note the following characteristics of thumbnail images:\n\n- A resource's `snippet.thumbnails` property is an object that identifies the thumbnail images available for that resource.\n- A `thumbnail` resource contains a series of objects. The name of each object (`default`, `medium`, `high`, etc.) refers to the thumbnail image size.\n- Different types of resources may support different thumbnail image sizes.\n- Different types of resources may define different sizes for thumbnail images with the same name. For example, the `default` thumbnail image for a `video` resource is typically 120px by 90px, and the `default` thumbnail image for a `channel` resource is typically 88px by 88px.\n- Resources of the same type may still have different thumbnail image sizes for certain images depending on the resolution of the original image or content uploaded to YouTube. For example, an HD video may support higher resolution thumbnails than non-HD videos.\n- Each object that contains information about a thumbnail image size has a `width` property and a `height` property. However, the width and height properties may not be returned for that image.\n- If an uploaded thumbnail image does not match the required dimensions, the image is resized to match the correct size without changing its aspect ratio. The image is not cropped, but may include black bars so that the size is correct.\n\n\u003cbr /\u003e\n\nMethods\n-------\n\nThe API supports the following methods for `thumbnails` resources:\n\n[set](/youtube/v3/docs/thumbnails/set)\n: Uploads a custom video thumbnail to YouTube and sets it for a video.\n\nResource representation\n-----------------------\n\nThe following JSON structure shows the format of a `thumbnails` resource: \n\n```text\n{\n \"default\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"medium\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"high\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"standard\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"maxres\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n }\n}\n```\n\n### Properties\n\nThe following table defines the properties that appear in this resource:\n\n| Properties ||\n|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `default` | `object` The default thumbnail image. The default thumbnail for a video -- or a resource that refers to a video, such as a playlist item or search result -- is 120px wide and 90px tall. The default thumbnail for a channel is 88px wide and 88px tall. |\n| default.`url` | `string` The image's URL. |\n| default.`width` | `unsigned integer` The image's width. |\n| default.`height` | `unsigned integer` The image's height. |\n| `medium` | `object` A higher resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 320px wide and 180px tall. For a channel, this image is 240px wide and 240px tall. |\n| medium.`url` | `string` The image's URL. |\n| medium.`width` | `unsigned integer` The image's width. |\n| medium.`height` | `unsigned integer` The image's height. |\n| `high` | `object` A high resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. |\n| high.`url` | `string` The image's URL. |\n| high.`width` | `unsigned integer` The image's width. |\n| high.`height` | `unsigned integer` The image's height. |\n| `standard` | `object` An even higher resolution version of the thumbnail image than the `high` resolution image. This image is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 640px wide and 480px tall. |\n| standard.`url` | `string` The image's URL. |\n| standard.`width` | `unsigned integer` The image's width. |\n| standard.`height` | `unsigned integer` The image's height. |\n| `maxres` | `object` 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. |\n| maxres.`url` | `string` The image's URL. |\n| maxres.`width` | `unsigned integer` The image's width. |\n| maxres.`height` | `unsigned integer` The image's height. |"]]