A video resource represents a YouTube video.
Methods
The API supports the following methods for videos resources:
- getRating
- Retrieve the ratings that the authorized user gave to a list of specified videos. Try it now.
- list
- Returns a list of videos that match the API request parameters. Try it now.
- insert
- Uploads a video to YouTube and optionally sets the video's metadata. Try it now.
- update
- Updates a video's metadata. Try it now.
- delete
- Deletes a YouTube video. Try it now.
- rate
- Add a like or dislike rating to a video or remove a rating from a video. Try it now.
Resource representation
The JSON structure below shows the format of a videos resource:
{
"id": string,
"kind": "youtube#video",
"etag": etag,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
},
"channelTitle": string,
"tags": [
string
],
"categoryId": string
},
"contentDetails": {
"duration": string,
"dimension": string,
"definition": string,
"caption": string,
"licensedContent": boolean,
"regionRestriction": {
"allowed": [
string
],
"blocked": [
string
]
},
"contentRating": {
"mpaaRating": string,
"tvpgRating": string,
"bbfcRating": string,
"chvrsRating": string,
"eirinRating": string,
"cbfcRating": string,
"fmocRating": string,
"icaaRating": string,
"acbRating": string,
"oflcRating": string,
"fskRating": string,
"kmrbRating": string,
"djctqRating": string,
"russiaRating": string,
"rtcRating": string
}
},
"player": {
"embedHtml": string
},
"statistics": {
"viewCount": unsigned long,
"likeCount": unsigned long,
"dislikeCount": unsigned long,
"favoriteCount": unsigned long,
"commentCount": unsigned long
},
"status": {
"uploadStatus": string,
"failureReason": string,
"rejectionReason": string,
"privacyStatus": string,
"license": string,
"embeddable": boolean,
"publicStatsViewable": boolean
},
"topicDetails": {
"topicIds": [
string
]
},
"recordingDetails": {
"location": {
"latitude": double,
"longitude": double,
"elevation": double
},
"locationDescription": string,
"recordingDate": datetime
},
"fileDetails": {
"fileName": string,
"fileSize": unsigned long,
"fileType": string,
"container": string,
"videoStreams": [
{
"widthPixels": unsigned integer,
"heightPixels": unsigned integer,
"frameRateFps": double,
"aspectRatio": double,
"codec": string,
"bitrateBps": unsigned long,
"rotation": string,
"vendor": string
}
],
"audioStreams": [
{
"channelCount": unsigned integer,
"codec": string,
"bitrateBps": unsigned long,
"vendor": string
}
],
"durationMs": unsigned long,
"bitrateBps": unsigned long,
"recordingLocation": {
"latitude": double,
"longitude": double,
"elevation": double
},
"creationTime": string
},
"processingDetails": {
"processingStatus": string,
"processingProgress": {
"partsTotal": unsigned long,
"partsProcessed": unsigned long,
"timeLeftMs": unsigned long
},
"processingFailureReason": string,
"fileDetailsAvailability": string,
"processingIssuesAvailability": string,
"tagSuggestionsAvailability": string,
"editorSuggestionsAvailability": string,
"thumbnailsAvailability": string
},
"suggestions": {
"processingErrors": [
string
],
"processingWarnings": [
string
],
"processingHints": [
string
],
"tagSuggestions": [
{
"tag": string,
"categoryRestricts": [
string
]
}
],
"editorSuggestions": [
string
]
}
}
Properties
The following table defines the properties that appear in this resource:
| Property name | Value | Description |
|---|---|---|
id |
string |
The ID that YouTube uses to uniquely identify the video. |
kind |
string |
The type of the API resource. For video resources, the value will be youtube#video. |
etag |
etag |
The ETag of the video resource. |
snippet |
nested object |
The snippet object contains basic details about the video, such as its title, description, and category. |
snippet.publishedAt |
datetime |
The date and time that the video was uploaded. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. |
snippet.channelId |
string |
The ID that YouTube uses to uniquely identify the channel that the video was uploaded to. |
snippet.title |
string |
The video's title. |
snippet.description |
string |
The video's description. |
snippet.thumbnails |
nested object |
A map of thumbnail images associated with the video. 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) |
nested object |
Valid key values are:
|
snippet.thumbnails.(key).url |
string |
The image's URL. |
snippet.thumbnails.(key).width |
unsigned integer |
The image's width. |
snippet.thumbnails.(key).height |
unsigned integer |
The image's height. |
snippet.channelTitle |
string |
Channel title for the channel that the video belongs to. |
snippet.tags[] |
list |
A list of keyword tags associated with the video. Tags may contain spaces. This field is only visible to the video's uploader. |
snippet.categoryId |
string |
The YouTube video category associated with the video. |
contentDetails |
nested object |
The contentDetails object contains information about the video content, including the length of the video and its aspect ratio. |
contentDetails.duration |
string |
The length of the video. The tag value is an ISO 8601 duration in the format PT#M#S, in which the letters PT indicate that the value specifies a period of time, and the letters M and S refer to length in minutes and seconds, respectively. The # characters preceding the M and S letters are both integers that specify the number of minutes (or seconds) of the video. For example, a value of PT15M51S indicates that the video is 15 minutes and 51 seconds long. |
contentDetails.dimension |
string |
Indicates whether the video is available in 3D or in 2D. |
contentDetails.definition |
string |
Indicates whether the video is available in high definition (HD) or only in standard definition.Valid values for this property are:
|
contentDetails.caption |
string |
Indicates whether captions are available for the video. Valid values for this property are:
|
contentDetails.licensedContent |
boolean |
Indicates whether the video represents licensed content, which means that the content has been claimed by a YouTube content partner. |
contentDetails.regionRestriction |
nested object |
The regionRestriction object contains information about the countries where a video is (or is not) viewable. The object will contain either the contentDetails.regionRestriction.allowed property or the contentDetails.regionRestriction.blocked property. |
contentDetails.regionRestriction.allowed[] |
list |
A list of region codes that identify countries where the video is viewable. If this property is present and a country is not listed in its value, then the video is blocked from appearing in that country. If this property is present and contains an empty list, the video is blocked in all countries. |
contentDetails.regionRestriction.blocked[] |
list |
A list of region codes that identify countries where the video is blocked. If this property is present and a country is not listed in its value, then the video is viewable in that country. If this property is present and contains an empty list, the video is viewable in all countries. |
contentDetails.contentRating |
nested object |
Specifies the ratings that the video received under various rating schemes. |
contentDetails.contentRating.mpaaRating |
string |
The video's Motion Picture Association of America (MPAA) rating. Valid values for this property are:
|
contentDetails.contentRating.tvpgRating |
string |
The video's TV Parental Guidelines (TVPG) rating. Valid values for this property are:
|
contentDetails.contentRating.bbfcRating |
string |
The video's British Board of Film Classification (BBFC) rating. Valid values for this property are:
|
contentDetails.contentRating.chvrsRating |
string |
The video's Canadian Home Video Rating System (CHVRS) rating. Valid values for this property are:
|
contentDetails.contentRating.eirinRating |
string |
The video's Eirin (映倫) rating. Eirin is the Japanese rating system. Valid values for this property are:
|
contentDetails.contentRating.cbfcRating |
string |
The video's Central Board of Film Certification (CBFC - India) rating. Valid values for this property are:
|
contentDetails.contentRating.fmocRating |
string |
The video's Centre national du cinéma et de l'image animé (French Ministry of Culture) rating. Valid values for this property are:
|
contentDetails.contentRating.icaaRating |
string |
The video's Instituto de la Cinematografía y de las Artes Audiovisuales (ICAA - Spain) rating. Valid values for this property are:
|
contentDetails.contentRating.acbRating |
string |
The video's Australian Classification Board (ACB) rating. Valid values for this property are:
|
contentDetails.contentRating.oflcRating |
string |
The video's Office of Film and Literature Classification (OFLC - New Zealand) rating. Valid values for this property are:
|
contentDetails.contentRating.fskRating |
string |
The video's Freiwillige Selbstkontrolle der Filmwirtschaft (FSK - Germany) rating. Valid values for this property are:
|
contentDetails.contentRating.kmrbRating |
string |
The video's Korea Media Rating Board (영상물등급위원회) rating. The KMRB rates videos in South Korea. Valid values for this property are:
|
contentDetails.contentRating.djctqRating |
string |
The video's Departamento de Justiça, Classificação, Qualificação e Títulos (DJCQT - Brazil) rating. Valid values for this property are:
|
contentDetails.contentRating.russiaRating |
string |
The video's National Film Registry of the Russian Federation (MKRF - Russia) rating. Valid values for this property are:
|
contentDetails.contentRating.rtcRating |
string |
The video's General Directorate of Radio, Television and Cinematography (Mexico) rating. Valid values for this property are:
|
player |
nested object |
The player object contains information that you would use to play the video in an embedded player. |
player.embedHtml |
string |
An <iframe> tag that embeds a player that will play the video. |
statistics |
nested object |
The statistics object contains statistics about the video. |
statistics.viewCount |
unsigned long |
The number of times the video has been viewed. |
statistics.likeCount |
unsigned long |
The number of users who have indicated that they liked the video by giving it a positive rating. |
statistics.dislikeCount |
unsigned long |
The number of users who have indicated that they disliked the video by giving it a negative rating. |
statistics.favoriteCount |
unsigned long |
The number of users who currently have the video marked as a favorite video. |
statistics.commentCount |
unsigned long |
The number of comments for the video. |
status |
nested object |
The status object contains information about the video's uploading, processing, and privacy statuses. |
status.uploadStatus |
string |
The status of the uploaded video. Valid values for this property are:
|
status.failureReason |
string |
This value explains why a video failed to upload. This property is only present if the uploadStatus property indicates that the upload failed.Valid values for this property are:
|
status.rejectionReason |
string |
This value explains why YouTube rejected an uploaded video. This property is only present if the uploadStatus property indicates that the upload was rejected.Valid values for this property are:
|
status.privacyStatus |
string |
The video's privacy status. Valid values for this property are:
|
status.license |
string |
The video's license. Valid values for this property are:
|
status.embeddable |
boolean |
This value indicates whether the video can be embedded on another website. |
status.publicStatsViewable |
boolean |
This value indicates whether the extended video statistics on the video's watch page are publicly viewable. By default, those statistics are viewable, and statistics like a video's viewcount and ratings will still be publicly visible even if this property's value is set to false. |
topicDetails |
nested object |
The topicDetails object encapsulates information about Freebase topics associated with the video. |
topicDetails.topicIds[] |
list |
A list of Freebase topic IDs associated with the video. You can retrieve information about each topic using the Freebase Topic API. |
recordingDetails |
nested object |
The recordingDetails object encapsulates information about the location, date and address where the video was recorded. This object will only be returned for a video if the video's geolocation data or recording time has been set. |
recordingDetails.location |
nested object |
The geolocation information associated with the video. |
recordingDetails.location.latitude |
double |
Latitude in degrees. |
recordingDetails.location.longitude |
double |
Longitude in degrees. |
recordingDetails.location.elevation |
double |
Altitude above the WGS 84 reference ellipsoid, in meters. |
recordingDetails.locationDescription |
string |
The text description of the location where the video was recorded. |
recordingDetails.recordingDate |
datetime |
The date and time when the video was recorded. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. |
fileDetails |
nested object |
The fileDetails object encapsulates information about the video file that was uploaded to YouTube, including the file's resolution, duration, audio and video codecs, stream bitrates, and more. This data can only be retrieved by the video owner. |
fileDetails.fileName |
string |
The uploaded file's name. This field is present whether a video file or another type of file was uploaded. |
fileDetails.fileSize |
unsigned long |
The uploaded file's size in bytes. This field is present whether a video file or another type of file was uploaded. |
fileDetails.fileType |
string |
The uploaded file's type as detected by YouTube's video processing engine. Currently, YouTube only processes video files, but this field is present whether a video file or another type of file was uploaded. Valid values for this property are:
|
fileDetails.container |
string |
The uploaded video file's container format. |
fileDetails.videoStreams[] |
list |
A list of video streams contained in the uploaded video file. Each item in the list contains detailed metadata about a video stream. |
fileDetails.videoStreams[].widthPixels |
unsigned integer |
The encoded video content's width in pixels. You can calculate the video's encoding aspect ratio as width_pixels / height_pixels. |
fileDetails.videoStreams[].heightPixels |
unsigned integer |
The encoded video content's height in pixels. |
fileDetails.videoStreams[].frameRateFps |
double |
The video stream's frame rate, in frames per second. |
fileDetails.videoStreams[].aspectRatio |
double |
The video content's display aspect ratio, which specifies the aspect ratio in which the video should be displayed. |
fileDetails.videoStreams[].codec |
string |
The video codec that the stream uses. |
fileDetails.videoStreams[].bitrateBps |
unsigned long |
The video stream's bitrate, in bits per second. |
fileDetails.videoStreams[].rotation |
string |
The amount that YouTube needs to rotate the original source content to properly display the video. Valid values for this property are:
|
fileDetails.videoStreams[].vendor |
string |
A value that uniquely identifies a video vendor. Typically, the value is a four-letter vendor code. |
fileDetails.audioStreams[] |
list |
A list of audio streams contained in the uploaded video file. Each item in the list contains detailed metadata about an audio stream. |
fileDetails.audioStreams[].channelCount |
unsigned integer |
The number of audio channels that the stream contains. |
fileDetails.audioStreams[].codec |
string |
The audio codec that the stream uses. |
fileDetails.audioStreams[].bitrateBps |
unsigned long |
The audio stream's bitrate, in bits per second. |
fileDetails.audioStreams[].vendor |
string |
A value that uniquely identifies a video vendor. Typically, the value is a four-letter vendor code. |
fileDetails.durationMs |
unsigned long |
The length of the uploaded video in milliseconds. |
fileDetails.bitrateBps |
unsigned long |
The uploaded video file's combined (video and audio) bitrate in bits per second. |
fileDetails.recordingLocation |
nested object |
Geographic coordinates that identify the place where the uploaded video was recorded. Coordinates are defined using WGS 84. |
fileDetails.recordingLocation.latitude |
double |
Latitude in degrees. |
fileDetails.recordingLocation.longitude |
double |
Longitude in degrees. |
fileDetails.recordingLocation.elevation |
double |
Altitude above the WGS 84 reference ellipsoid, in meters. |
fileDetails.creationTime |
string |
The date and time when the uploaded video file was created. The value is specified in ISO 8601 format. Currently, the following ISO 8601 formats are supported:
|
processingDetails |
nested object |
The processingProgress object encapsulates information about YouTube's progress in processing the uploaded video file. The properties in the object identify the current processing status and an estimate of the time remaining until YouTube finishes processing the video. This part also indicates whether different types of data or content, such as file details or thumbnail images, are available for the video.The processingProgress object is designed to be polled so that the video uploaded can track the progress that YouTube has made in processing the uploaded video file. This data can only be retrieved by the video owner. |
processingDetails.processingStatus |
string |
The video's processing status. This value indicates whether YouTube was able to process the video or if the video is still being processed. Valid values for this property are:
|
processingDetails.processingProgress |
nested object |
The processingProgress object contains information about the progress YouTube has made in processing the video. The values are really only relevant if the video's processing status is processing. |
processingDetails.processingProgress.partsTotal |
unsigned long |
An estimate of the total number of parts that need to be processed for the video. The number may be updated with more precise estimates while YouTube processes the video. |
processingDetails.processingProgress.partsProcessed |
unsigned long |
The number of parts of the video that YouTube has already processed. You can estimate the percentage of the video that YouTube has already processed by calculating:100 * parts_processed / parts_totalNote that since the estimated number of parts could increase without a corresponding increase in the number of parts that have already been processed, it is possible that the calculated progress could periodically decrease while YouTube processes a video. |
processingDetails.processingProgress.timeLeftMs |
unsigned long |
An estimate of the amount of time, in millseconds, that YouTube needs to finish processing the video. |
processingDetails.processingFailureReason |
string |
The reason that YouTube failed to process the video. This property will only have a value if the processingStatus property's value is failed.Valid values for this property are:
|
processingDetails.fileDetailsAvailability |
string |
This value indicates whether file details are available for the uploaded video. You can retrieve a video's file details by requesting the fileDetails part in your videos.list() request. |
processingDetails.processingIssuesAvailability |
string |
This value indicates whether the video processing engine has generated suggestions that might improve YouTube's ability to process the the video, warnings that explain video processing problems, or errors that cause video processing problems. You can retrieve these suggestions by requesting the suggestions part in your videos.list() request. |
processingDetails.tagSuggestionsAvailability |
string |
This value indicates whether keyword (tag) suggestions are available for the video. Tags can be added to a video's metadata to make it easier for other users to find the video. You can retrieve these suggestions by requesting the suggestions part in your videos.list() request. |
processingDetails.editorSuggestionsAvailability |
string |
This value indicates whether video editing suggestions, which might improve video quality or the playback experience, are available for the video. You can retrieve these suggestions by requesting the suggestions part in your videos.list() request. |
processingDetails.thumbnailsAvailability |
string |
This value indicates whether thumbnail images have been generated for the video. |
suggestions |
nested object |
The suggestions object encapsulates suggestions that identify opportunities to improve the video quality or the metadata for the uploaded video. This data can only be retrieved by the video owner. |
suggestions.processingErrors[] |
list |
A list of errors that will prevent YouTube from successfully processing the uploaded video. These errors indicate that, regardless of the video's current processing status, eventually, that status will almost certainly be failed.Valid values for this property are:
|
suggestions.processingWarnings[] |
list |
A list of reasons why YouTube may have difficulty transcoding the uploaded video or that might result in an erroneous transcoding. These warnings are generated before YouTube actually processes the uploaded video file. In addition, they identify issues that do not necessarily indicate that video processing will fail but that still might cause problems such as sync issues, video artifacts, or a missing audio track. Valid values for this property are:
|
suggestions.processingHints[] |
list |
A list of suggestions that may improve YouTube's ability to process the video. Valid values for this property are:
|
suggestions.tagSuggestions[] |
list |
A list of keyword tags that could be added to the video's metadata to increase the likelihood that users will locate your video when searching or browsing on YouTube. |
suggestions.tagSuggestions[].tag |
string |
The keyword tag suggested for the video. |
suggestions.tagSuggestions[].categoryRestricts[] |
list |
A set of video categories for which the tag is relevant. You can use this information to display appropriate tag suggestions based on the video category that the video uploader associates with the video. By default, tag suggestions are relevant for all categories if there are no restricts defined for the keyword. |
suggestions.editorSuggestions[] |
list |
A list of video editing operations that might improve the video quality or playback experience of the uploaded video. Valid values for this property are:
|