Chúng tôi đang cập nhật Data API để phù hợp với cách YouTube tính số lượt xem video ngắn.
Tìm hiểu thêm
Thumbnails
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài nguyên thumbnail
xác định nhiều kích thước hình thu nhỏ được liên kết với một tài nguyên. Xin lưu ý những đặc điểm sau đây của hình thu nhỏ:
- Thuộc tính
snippet.thumbnails
của tài nguyên là một đối tượng xác định hình thu nhỏ có sẵn cho tài nguyên đó. - Tài nguyên
thumbnail
chứa một loạt đối tượng. Tên của mỗi đối tượng (default
, medium
, high
, v.v.) đề cập đến kích thước hình thu nhỏ. - Các loại tài nguyên khác nhau có thể hỗ trợ nhiều kích thước hình thu nhỏ.
- Các loại tài nguyên khác nhau có thể xác định các kích thước khác nhau cho hình thu nhỏ có cùng tên. Ví dụ: hình thu nhỏ
default
cho tài nguyên video
thường có kích thước 120px x 90px, còn hình thu nhỏ default
cho tài nguyên channel
thường có kích thước 88px x 88px. - Các tài nguyên cùng loại vẫn có thể có kích thước hình thu nhỏ khác nhau đối với một số hình ảnh, tuỳ thuộc vào độ phân giải của hình ảnh hoặc nội dung gốc được tải lên YouTube. Ví dụ: video HD có thể hỗ trợ hình thu nhỏ có độ phân giải cao hơn so với video không phải HD.
- Mỗi đối tượng chứa thông tin về kích thước hình thu nhỏ đều có một thuộc tính
width
và một thuộc tính height
. Tuy nhiên, các thuộc tính chiều rộng và chiều cao có thể không được trả về cho hình ảnh đó. - Nếu hình thu nhỏ được tải lên không có kích thước theo yêu cầu, thì hình ảnh đó sẽ được đổi kích thước cho phù hợp mà không thay đổi tỷ lệ khung hình. Hình ảnh không bị cắt nhưng có thể có các thanh màu đen để đảm bảo kích thước chính xác.
Phương thức
API này hỗ trợ các phương thức sau cho tài nguyên thumbnails
:
- set
- Tải một hình thu nhỏ tuỳ chỉnh cho video lên YouTube và đặt hình thu nhỏ đó cho một video.
Cách trình bày tài nguyên
Cấu trúc JSON sau đây cho thấy định dạng của tài nguyên 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
}
}
Thuộc tính
Bảng sau đây xác định các thuộc tính xuất hiện trong tài nguyên này:
Thuộc tính |
default |
object
Hình thu nhỏ mặc định. Hình thu nhỏ mặc định cho một video (hoặc một tài nguyên đề cập đến video, chẳng hạn như một mục trong danh sách phát hoặc kết quả tìm kiếm) có chiều rộng 120 pixel và chiều cao 90 pixel. Hình thu nhỏ mặc định của kênh có kích thước rộng 88 pixel và cao 88 pixel. |
default.url |
string
URL của hình ảnh. |
default.width |
unsigned integer
Chiều rộng của hình ảnh. |
default.height |
unsigned integer
Chiều cao của hình ảnh. |
medium |
object
Phiên bản có độ phân giải cao hơn của hình thu nhỏ. Đối với video (hoặc tài nguyên đề cập đến video), hình ảnh này có chiều rộng 320 px và chiều cao 180 px. Đối với kênh, hình ảnh này có chiều rộng 240 px và chiều cao 240 px. |
medium.url |
string
URL của hình ảnh. |
medium.width |
unsigned integer
Chiều rộng của hình ảnh. |
medium.height |
unsigned integer
Chiều cao của hình ảnh. |
high |
object
Phiên bản có độ phân giải cao của hình thu nhỏ. Đối với video (hoặc tài nguyên đề cập đến video), hình ảnh này có chiều rộng 480 pixel và chiều cao 360 pixel. Đối với kênh, hình ảnh này có chiều rộng 800px và chiều cao 800px. |
high.url |
string
URL của hình ảnh. |
high.width |
unsigned integer
Chiều rộng của hình ảnh. |
high.height |
unsigned integer
Chiều cao của hình ảnh. |
standard |
object
Phiên bản hình thu nhỏ có độ phân giải cao hơn cả hình ảnh có độ phân giải high . Hình ảnh này xuất hiện ở một số video và các tài nguyên khác có liên quan đến video, chẳng hạn như các mục trong danh sách phát hoặc kết quả tìm kiếm. Hình ảnh này có chiều rộng 640 px và chiều cao 480 px. |
standard.url |
string
URL của hình ảnh. |
standard.width |
unsigned integer
Chiều rộng của hình ảnh. |
standard.height |
unsigned integer
Chiều cao của hình ảnh. |
maxres |
object
Phiên bản có độ phân giải cao nhất của hình thu nhỏ. Kích thước hình ảnh này có ở một số video và các tài nguyên khác có liên quan đến video, chẳng hạn như các mục trong danh sách phát hoặc kết quả tìm kiếm. Hình ảnh này có chiều rộng 1280px và chiều cao 720px. |
maxres.url |
string
URL của hình ảnh. |
maxres.width |
unsigned integer
Chiều rộng của hình ảnh. |
maxres.height |
unsigned integer
Chiều cao của hình ảnh. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-21 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]