Search
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
search
結果包含 YouTube 影片、頻道或播放清單的資訊,這些資訊與 API 要求中指定的搜尋參數相符。雖然搜尋結果會指向可辨識的資源 (例如影片),但它沒有自己的持續性資料。
資源表示法
以下 JSON 結構顯示搜尋結果的格式:
{
"kind": "youtube#searchResult",
"etag": etag,
"id": {
"kind": string,
"videoId": string,
"channelId": string,
"playlistId": string
},
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
},
"channelTitle": string,
"liveBroadcastContent": string
}
}
屬性
下表定義搜尋結果中顯示的屬性:
屬性 |
kind |
string
識別 API 資源的類型。值為 youtube#searchResult 。 |
etag |
etag
這項資源的 Etag。 |
id |
object
id 物件包含可用於唯一識別符合搜尋要求的資源的資訊。 |
id.kind |
string
API 資源的類型。 |
id.videoId |
string
如果 id.type 屬性值為 youtube#video ,則會出現這個屬性,且其值會包含 YouTube 用來識別符合搜尋查詢的影片的 ID。 |
id.channelId |
string
如果 id.type 屬性值為 youtube#channel ,系統就會提供這項屬性,其值包含 YouTube 用來識別符合搜尋查詢的頻道 ID。 |
id.playlistId |
string
如果 id.type 屬性值為 youtube#playlist ,系統就會提供這個屬性,且其值會包含 YouTube 用來識別與搜尋查詢相符的播放清單的 ID。 |
snippet |
object
snippet 物件包含搜尋結果的基本詳細資料,例如標題或說明。舉例來說,如果搜尋結果是影片,標題就會是影片的標題,說明則是影片的說明。 |
snippet.publishedAt |
datetime
搜尋結果所識別資源的建立日期和時間。這個值採用 ISO 8601 格式指定。 |
snippet.channelId |
string
YouTube 用來識別搜尋結果中所指明資源的頻道。 |
snippet.title |
string
搜尋結果的標題。 |
snippet.description |
string
搜尋結果的說明。 |
snippet.thumbnails |
object
與搜尋結果相關聯的縮圖圖片地圖。對於地圖中的每個物件,鍵是縮圖圖片的名稱,值則是包含縮圖其他資訊的物件。 |
snippet.thumbnails.(key) |
object
有效的鍵值如下:default :預設縮圖圖片。影片或影片相關資源 (例如播放清單項目或搜尋結果) 的預設縮圖寬度為 120 像素,高度為 90 像素。頻道的預設縮圖寬度和高度為 88 像素。medium :縮圖圖片的高解析度版本。對於影片 (或參照影片的資源),這張圖片的寬度為 320 像素,高度為 180 像素。頻道的圖片寬度和高度為 240 像素。high – 縮圖圖片的高解析度版本。對於影片 (或參照影片的資源),這張圖片的寬度為 480 像素,高度為 360 像素。頻道的圖片寬度和高度為 800 像素。standard :縮圖圖片的解析度比 high 解析度圖片更高。這張圖片適用於部分影片和其他參照影片的資源,例如播放清單項目或搜尋結果。此圖片的寬度為 640 像素,高度為 480 像素。maxres :縮圖圖片的最高解析度版本。部分影片和其他參照影片的資源 (例如播放清單項目或搜尋結果) 會使用這個圖片大小。此圖片的寬度為 1280 像素,高度為 720 像素。
|
snippet.thumbnails.(key).url |
string
圖片的網址。 |
snippet.thumbnails.(key).width |
unsigned integer
圖片的寬度。 |
snippet.thumbnails.(key).height |
unsigned integer
圖片的高度。 |
snippet.channelTitle |
string
搜尋結果所識別的資源所屬頻道名稱。 |
snippet.liveBroadcastContent |
string
指示 video 或 channel 資源是否含有直播內容。有效的屬性值為 upcoming 、live 和 none 。
如果是 video 資源,值為 upcoming 表示影片是尚未開始的直播,而值為 live 則表示影片是正在進行的直播。對於 channel 資源,如果值為 upcoming ,表示頻道有尚未開始的預定直播,如果值為 live ,則表示頻道有正在進行的直播。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-15 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-11-15 (世界標準時間)。"],[[["Search results from the API provide information about YouTube videos, channels, or playlists that match specific search criteria, without containing persistent data themselves."],["The `search/list` method returns a collection of search results and can be configured to retrieve specific resource types like videos, channels, or playlists."],["Each search result contains an `id` object that uniquely identifies the matched resource, and the `kind` property within this object specifies whether it is a video, channel, or playlist."],["The `snippet` object in a search result includes basic details like the title, description, channel information, publishing date, and thumbnail images related to the search result."],["Thumbnail images in a search result are provided in various resolutions (`default`, `medium`, `high`, `standard`, `maxres`), with each having its own URL, width, and height."]]],["The YouTube API's `search/list` method retrieves search results matching specified parameters. These results point to videos, channels, or playlists but don't store their own data. Each result contains an `id` object for identification (video, channel, or playlist ID) and a `snippet` with details like title, description, publication date, channel information, and thumbnails. The results' `kind` is `youtube#searchResult`, and `etag` holds the resource's Etag. You can also filter searches by a specific resource type.\n"]]