AI-generated Key Takeaways
-
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/listmethod 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
idobject that uniquely identifies the matched resource, and thekindproperty within this object specifies whether it is a video, channel, or playlist. -
The
snippetobject 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.
A search result contains information about a YouTube video, channel, or playlist that matches the search parameters specified in an API request. While a search result points to a uniquely identifiable resource, like a video, it does not have its own persistent data.
Methods
The API supports the following methods for search:
- list
- Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching
video,channel, andplaylistresources, but you can also configure queries to only retrieve a specific type of resource. Try it now.
Resource representation
The following JSON structure shows the format of a search result:
{
"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
}
}Properties
The following table defines the properties that appear in a search result:
| Properties | |
|---|---|
kind |
stringIdentifies the API resource's type. The value will be youtube#searchResult. |
etag |
etagThe Etag of this resource. |
id |
objectThe id object contains information that can be used to uniquely identify the resource that matches the search request. |
id.kind |
stringThe type of the API resource. |
id.videoId |
stringIf the id.type property's value is youtube#video, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a video that matches the search query. |
id.channelId |
stringIf the id.type property's value is youtube#channel, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a channel that matches the search query. |
id.playlistId |
stringIf the id.type property's value is youtube#playlist, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify a playlist that matches the search query. |
snippet |
objectThe snippet object contains basic details about a search result, such as its title or description. For example, if the search result is a video, then the title will be the video's title and the description will be the video's description. |
snippet.publishedAt |
datetimeThe creation date and time of the resource that the search result identifies. The value is specified in ISO 8601 format. |
snippet.channelId |
stringThe value that YouTube uses to uniquely identify the channel that published the resource that the search result identifies. |
snippet.title |
stringThe title of the search result. |
snippet.description |
stringA description of the search result. |
snippet.thumbnails |
objectA map of thumbnail images associated with the search result. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. |
snippet.thumbnails.(key) |
objectValid key values are:
|
snippet.thumbnails.(key).url |
stringThe image's URL. |
snippet.thumbnails.(key).width |
unsigned integerThe image's width. |
snippet.thumbnails.(key).height |
unsigned integerThe image's height. |
snippet.channelTitle |
stringThe title of the channel that published the resource that the search result identifies. |
snippet.liveBroadcastContent |
stringAn indication of whether a video or channel resource has live broadcast content. Valid property values are upcoming, live, and none.For a video resource, a value of upcoming indicates that the video is a live broadcast that has not yet started, while a value of live indicates that the video is an active live broadcast. For a channel resource, a value of upcoming indicates that the channel has a scheduled broadcast that has not yet started, while a value of live indicates that the channel has an active live broadcast. |