1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="youtube_v3.html">YouTube Data API</a> . <a href="youtube_v3.captions.html">captions</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#delete">delete(id, onBehalfOf=None, onBehalfOfContentOwner=None)</a></code></p> 79<p class="firstline">Deletes a specified caption track.</p> 80<p class="toc_element"> 81 <code><a href="#download">download(id, onBehalfOf=None, tlang=None, onBehalfOfContentOwner=None, tfmt=None)</a></code></p> 82<p class="firstline">Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.</p> 83<p class="toc_element"> 84 <code><a href="#download_media">download_media(id, onBehalfOf=None, tlang=None, onBehalfOfContentOwner=None, tfmt=None)</a></code></p> 85<p class="firstline">Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.</p> 86<p class="toc_element"> 87 <code><a href="#insert">insert(part, body=None, media_body=None, onBehalfOf=None, media_mime_type=None, sync=None, onBehalfOfContentOwner=None)</a></code></p> 88<p class="firstline">Uploads a caption track.</p> 89<p class="toc_element"> 90 <code><a href="#list">list(part, videoId, onBehalfOf=None, onBehalfOfContentOwner=None, id=None)</a></code></p> 91<p class="firstline">Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track.</p> 92<p class="toc_element"> 93 <code><a href="#update">update(part, body=None, media_body=None, onBehalfOf=None, media_mime_type=None, sync=None, onBehalfOfContentOwner=None)</a></code></p> 94<p class="firstline">Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both.</p> 95<h3>Method Details</h3> 96<div class="method"> 97 <code class="details" id="delete">delete(id, onBehalfOf=None, onBehalfOfContentOwner=None)</code> 98 <pre>Deletes a specified caption track. 99 100Args: 101 id: string, The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource. (required) 102 onBehalfOf: string, ID of the Google+ Page for the channel that the request is be on behalf of 103 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 104 105The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 106</pre> 107</div> 108 109<div class="method"> 110 <code class="details" id="download">download(id, onBehalfOf=None, tlang=None, onBehalfOfContentOwner=None, tfmt=None)</code> 111 <pre>Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. 112 113Args: 114 id: string, The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. (required) 115 onBehalfOf: string, ID of the Google+ Page for the channel that the request is be on behalf of 116 tlang: string, The tlang parameter specifies that the API response should return a translation of the specified caption track. The parameter value is an ISO 639-1 two-letter language code that identifies the desired caption language. The translation is generated by using machine translation, such as Google Translate. 117 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 118 119The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 120 tfmt: string, The tfmt parameter specifies that the caption track should be returned in a specific format. If the parameter is not included in the request, the track is returned in its original format. 121 Allowed values 122 sbv - SubViewer subtitle. 123 scc - Scenarist Closed Caption format. 124 srt - SubRip subtitle. 125 ttml - Timed Text Markup Language caption. 126 vtt - Web Video Text Tracks caption. 127</pre> 128</div> 129 130<div class="method"> 131 <code class="details" id="download_media">download_media(id, onBehalfOf=None, tlang=None, onBehalfOfContentOwner=None, tfmt=None)</code> 132 <pre>Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. 133 134Args: 135 id: string, The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. (required) 136 onBehalfOf: string, ID of the Google+ Page for the channel that the request is be on behalf of 137 tlang: string, The tlang parameter specifies that the API response should return a translation of the specified caption track. The parameter value is an ISO 639-1 two-letter language code that identifies the desired caption language. The translation is generated by using machine translation, such as Google Translate. 138 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 139 140The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 141 tfmt: string, The tfmt parameter specifies that the caption track should be returned in a specific format. If the parameter is not included in the request, the track is returned in its original format. 142 Allowed values 143 sbv - SubViewer subtitle. 144 scc - Scenarist Closed Caption format. 145 srt - SubRip subtitle. 146 ttml - Timed Text Markup Language caption. 147 vtt - Web Video Text Tracks caption. 148</pre> 149</div> 150 151<div class="method"> 152 <code class="details" id="insert">insert(part, body=None, media_body=None, onBehalfOf=None, media_mime_type=None, sync=None, onBehalfOfContentOwner=None)</code> 153 <pre>Uploads a caption track. 154 155Args: 156 part: string, The part parameter specifies the caption resource parts that the API response will include. Set the parameter value to snippet. (required) 157 body: object, The request body. 158 The object takes the form of: 159 160{ # A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video. 161 "snippet": { # Basic details about a caption track, such as its language and name. # The snippet object contains basic details about the caption. 162 "status": "A String", # The caption track's status. 163 "audioTrackType": "A String", # The type of audio track associated with the caption track. 164 "language": "A String", # The language of the caption track. The property value is a BCP-47 language tag. 165 "name": "A String", # The name of the caption track. The name is intended to be visible to the user as an option during playback. 166 "videoId": "A String", # The ID that YouTube uses to uniquely identify the video associated with the caption track. 167 "isDraft": True or False, # Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. 168 "isAutoSynced": True or False, # Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. 169 "trackKind": "A String", # The caption track's type. 170 "lastUpdated": "A String", # The date and time when the caption track was last updated. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 171 "isCC": True or False, # Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. 172 "isEasyReader": True or False, # Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. 173 "isLarge": True or False, # Indicates whether the caption track uses large text for the vision-impaired. The default value is false. 174 "failureReason": "A String", # The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. 175 }, 176 "kind": "youtube#caption", # Identifies what kind of resource this is. Value: the fixed string "youtube#caption". 177 "etag": "A String", # Etag of this resource. 178 "id": "A String", # The ID that YouTube uses to uniquely identify the caption track. 179 } 180 181 media_body: string, The filename of the media request body, or an instance of a MediaUpload object. 182 onBehalfOf: string, ID of the Google+ Page for the channel that the request is be on behalf of 183 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. 184 sync: boolean, The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will disregard any time codes that are in the uploaded caption file and generate new time codes for the captions. 185 186You should set the sync parameter to true if you are uploading a transcript, which has no time codes, or if you suspect the time codes in your file are incorrect and want YouTube to try to fix them. 187 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 188 189The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 190 191Returns: 192 An object of the form: 193 194 { # A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video. 195 "snippet": { # Basic details about a caption track, such as its language and name. # The snippet object contains basic details about the caption. 196 "status": "A String", # The caption track's status. 197 "audioTrackType": "A String", # The type of audio track associated with the caption track. 198 "language": "A String", # The language of the caption track. The property value is a BCP-47 language tag. 199 "name": "A String", # The name of the caption track. The name is intended to be visible to the user as an option during playback. 200 "videoId": "A String", # The ID that YouTube uses to uniquely identify the video associated with the caption track. 201 "isDraft": True or False, # Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. 202 "isAutoSynced": True or False, # Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. 203 "trackKind": "A String", # The caption track's type. 204 "lastUpdated": "A String", # The date and time when the caption track was last updated. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 205 "isCC": True or False, # Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. 206 "isEasyReader": True or False, # Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. 207 "isLarge": True or False, # Indicates whether the caption track uses large text for the vision-impaired. The default value is false. 208 "failureReason": "A String", # The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. 209 }, 210 "kind": "youtube#caption", # Identifies what kind of resource this is. Value: the fixed string "youtube#caption". 211 "etag": "A String", # Etag of this resource. 212 "id": "A String", # The ID that YouTube uses to uniquely identify the caption track. 213 }</pre> 214</div> 215 216<div class="method"> 217 <code class="details" id="list">list(part, videoId, onBehalfOf=None, onBehalfOfContentOwner=None, id=None)</code> 218 <pre>Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track. 219 220Args: 221 part: string, The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet. (required) 222 videoId: string, The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks. (required) 223 onBehalfOf: string, ID of the Google+ Page for the channel that the request is on behalf of. 224 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 225 226The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 227 id: string, The id parameter specifies a comma-separated list of IDs that identify the caption resources that should be retrieved. Each ID must identify a caption track associated with the specified video. 228 229Returns: 230 An object of the form: 231 232 { 233 "eventId": "A String", # Serialized EventId of the request which produced this response. 234 "items": [ # A list of captions that match the request criteria. 235 { # A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video. 236 "snippet": { # Basic details about a caption track, such as its language and name. # The snippet object contains basic details about the caption. 237 "status": "A String", # The caption track's status. 238 "audioTrackType": "A String", # The type of audio track associated with the caption track. 239 "language": "A String", # The language of the caption track. The property value is a BCP-47 language tag. 240 "name": "A String", # The name of the caption track. The name is intended to be visible to the user as an option during playback. 241 "videoId": "A String", # The ID that YouTube uses to uniquely identify the video associated with the caption track. 242 "isDraft": True or False, # Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. 243 "isAutoSynced": True or False, # Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. 244 "trackKind": "A String", # The caption track's type. 245 "lastUpdated": "A String", # The date and time when the caption track was last updated. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 246 "isCC": True or False, # Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. 247 "isEasyReader": True or False, # Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. 248 "isLarge": True or False, # Indicates whether the caption track uses large text for the vision-impaired. The default value is false. 249 "failureReason": "A String", # The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. 250 }, 251 "kind": "youtube#caption", # Identifies what kind of resource this is. Value: the fixed string "youtube#caption". 252 "etag": "A String", # Etag of this resource. 253 "id": "A String", # The ID that YouTube uses to uniquely identify the caption track. 254 }, 255 ], 256 "kind": "youtube#captionListResponse", # Identifies what kind of resource this is. Value: the fixed string "youtube#captionListResponse". 257 "etag": "A String", # Etag of this resource. 258 "visitorId": "A String", # The visitorId identifies the visitor. 259 }</pre> 260</div> 261 262<div class="method"> 263 <code class="details" id="update">update(part, body=None, media_body=None, onBehalfOf=None, media_mime_type=None, sync=None, onBehalfOfContentOwner=None)</code> 264 <pre>Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. 265 266Args: 267 part: string, The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the property value to snippet if you are updating the track's draft status. Otherwise, set the property value to id. (required) 268 body: object, The request body. 269 The object takes the form of: 270 271{ # A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video. 272 "snippet": { # Basic details about a caption track, such as its language and name. # The snippet object contains basic details about the caption. 273 "status": "A String", # The caption track's status. 274 "audioTrackType": "A String", # The type of audio track associated with the caption track. 275 "language": "A String", # The language of the caption track. The property value is a BCP-47 language tag. 276 "name": "A String", # The name of the caption track. The name is intended to be visible to the user as an option during playback. 277 "videoId": "A String", # The ID that YouTube uses to uniquely identify the video associated with the caption track. 278 "isDraft": True or False, # Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. 279 "isAutoSynced": True or False, # Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. 280 "trackKind": "A String", # The caption track's type. 281 "lastUpdated": "A String", # The date and time when the caption track was last updated. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 282 "isCC": True or False, # Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. 283 "isEasyReader": True or False, # Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. 284 "isLarge": True or False, # Indicates whether the caption track uses large text for the vision-impaired. The default value is false. 285 "failureReason": "A String", # The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. 286 }, 287 "kind": "youtube#caption", # Identifies what kind of resource this is. Value: the fixed string "youtube#caption". 288 "etag": "A String", # Etag of this resource. 289 "id": "A String", # The ID that YouTube uses to uniquely identify the caption track. 290 } 291 292 media_body: string, The filename of the media request body, or an instance of a MediaUpload object. 293 onBehalfOf: string, ID of the Google+ Page for the channel that the request is be on behalf of 294 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. 295 sync: boolean, Note: The API server only processes the parameter value if the request contains an updated caption file. 296 297The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will automatically synchronize the caption track with the audio track. 298 onBehalfOfContentOwner: string, Note: This parameter is intended exclusively for YouTube content partners. 299 300The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. 301 302Returns: 303 An object of the form: 304 305 { # A caption resource represents a YouTube caption track. A caption track is associated with exactly one YouTube video. 306 "snippet": { # Basic details about a caption track, such as its language and name. # The snippet object contains basic details about the caption. 307 "status": "A String", # The caption track's status. 308 "audioTrackType": "A String", # The type of audio track associated with the caption track. 309 "language": "A String", # The language of the caption track. The property value is a BCP-47 language tag. 310 "name": "A String", # The name of the caption track. The name is intended to be visible to the user as an option during playback. 311 "videoId": "A String", # The ID that YouTube uses to uniquely identify the video associated with the caption track. 312 "isDraft": True or False, # Indicates whether the caption track is a draft. If the value is true, then the track is not publicly visible. The default value is false. 313 "isAutoSynced": True or False, # Indicates whether YouTube synchronized the caption track to the audio track in the video. The value will be true if a sync was explicitly requested when the caption track was uploaded. For example, when calling the captions.insert or captions.update methods, you can set the sync parameter to true to instruct YouTube to sync the uploaded track to the video. If the value is false, YouTube uses the time codes in the uploaded caption track to determine when to display captions. 314 "trackKind": "A String", # The caption track's type. 315 "lastUpdated": "A String", # The date and time when the caption track was last updated. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. 316 "isCC": True or False, # Indicates whether the track contains closed captions for the deaf and hard of hearing. The default value is false. 317 "isEasyReader": True or False, # Indicates whether caption track is formatted for "easy reader," meaning it is at a third-grade level for language learners. The default value is false. 318 "isLarge": True or False, # Indicates whether the caption track uses large text for the vision-impaired. The default value is false. 319 "failureReason": "A String", # The reason that YouTube failed to process the caption track. This property is only present if the state property's value is failed. 320 }, 321 "kind": "youtube#caption", # Identifies what kind of resource this is. Value: the fixed string "youtube#caption". 322 "etag": "A String", # Etag of this resource. 323 "id": "A String", # The ID that YouTube uses to uniquely identify the caption track. 324 }</pre> 325</div> 326 327</body></html>