YouTubePHP Documentation

CaptionsApi extends AbstractApi
in package

FinalYes

This file is generated from spec/discovery.json (YouTube Data API v3, revision 20260924) by tools/generate.php. Do not edit it by hand - run `composer spec:build` instead.

The caption tracks of videos.

Reach it as $youtube->captions. Every method takes the parameters Google documents, by the same names: use named arguments for the optional ones.

Tags
link
https://developers.google.com/youtube/v3/docs/captions
since
1.0.0

Table of Contents

Properties

$youtube  : YouTube

Methods

__construct()  : mixed
delete()  : PromiseInterface<string|int, null>
Deletes a resource.
download()  : PromiseInterface<string|int, string>
Downloads a caption track.
insert()  : PromiseInterface<string|int, Caption>
Inserts a new resource into this collection.
list()  : PromiseInterface<string|int, CaptionListResponse>
Retrieves a list of resources, possibly filtered.
update()  : PromiseInterface<string|int, Caption>
Updates an existing resource.
call()  : PromiseInterface<string|int, mixed>
streamed()  : PromiseInterface<string|int, ResponseStream>
Opens a server-streamed call and reads its body as it arrives.

Properties

Methods

delete()

Deletes a resource.

public delete(string $id[, string|null $onBehalfOf = null ][, string|null $onBehalfOfContentOwner = null ]) : PromiseInterface<string|int, null>

Costs 50 units of quota.

Parameters
$id : string
$onBehalfOf : string|null = null

ID of the Google+ Page for the channel that the request is be on behalf of

$onBehalfOfContentOwner : string|null = null

Note: This parameter is intended exclusively for YouTube content partners. The 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.

Tags
link
https://developers.google.com/youtube/v3/docs/captions/delete
since
1.0.0
Return values
PromiseInterface<string|int, null>

download()

Downloads a caption track.

public download(string $id[, string|null $onBehalfOf = null ][, string|null $onBehalfOfContentOwner = null ][, string|null $tfmt = null ][, string|null $tlang = null ]) : PromiseInterface<string|int, string>

Costs 200 units of quota.

Parameters
$id : string

The ID of the caption track to download, required for One Platform.

$onBehalfOf : string|null = null

ID of the Google+ Page for the channel that the request is be on behalf of

$onBehalfOfContentOwner : string|null = null

Note: This parameter is intended exclusively for YouTube content partners. The 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.

$tfmt : string|null = null

Convert the captions into this format. Supported options are sbv, srt, and vtt.

$tlang : string|null = null

tlang is the language code; machine translate the captions into this language.

Tags
link
https://developers.google.com/youtube/v3/docs/captions/download
since
1.0.0
Return values
PromiseInterface<string|int, string> —

The file.

insert()

Inserts a new resource into this collection.

public insert(array<int, string>|string $part, Caption|array<string, mixed> $body[, Media|null $media = null ][, string|null $onBehalfOf = null ][, string|null $onBehalfOfContentOwner = null ][, bool|null $sync = null ]) : PromiseInterface<string|int, Caption>

Costs 400 units of quota.

Parameters
$part : array<int, string>|string

The part parameter specifies the caption resource parts that the API response will include. Set the parameter value to snippet.

$body : Caption|array<string, mixed>

The Caption to send.

$media : Media|null = null

The file to upload: text/xml, application/octet-stream, /, up to 100 MB. Sent in the same request as the metadata.

$onBehalfOf : string|null = null

ID of the Google+ Page for the channel that the request is be on behalf of

$onBehalfOfContentOwner : string|null = null

Note: This parameter is intended exclusively for YouTube content partners. The 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.

$sync : bool|null = null

Extra parameter to allow automatically syncing the uploaded caption/transcript with the audio.

Tags
link
https://developers.google.com/youtube/v3/docs/captions/insert
since
1.0.0
Return values
PromiseInterface<string|int, Caption>

list()

Retrieves a list of resources, possibly filtered.

public list(array<int, string>|string $part, string $videoId[, array<int, string>|string|null $id = null ][, string|null $onBehalfOf = null ][, string|null $onBehalfOfContentOwner = null ]) : PromiseInterface<string|int, CaptionListResponse>

Costs 50 units of quota.

Parameters
$part : array<int, string>|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.

$videoId : string

Returns the captions for the specified video.

$id : array<int, string>|string|null = null

Returns the captions with the given IDs for Stubby or Apiary.

$onBehalfOf : string|null = null

ID of the Google+ Page for the channel that the request is on behalf of.

$onBehalfOfContentOwner : string|null = null

Note: This parameter is intended exclusively for YouTube content partners. The 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.

Tags
link
https://developers.google.com/youtube/v3/docs/captions/list
since
1.0.0
Return values
PromiseInterface<string|int, CaptionListResponse>

update()

Updates an existing resource.

public update(array<int, string>|string $part, Caption|array<string, mixed> $body[, Media|null $media = null ][, string|null $onBehalfOf = null ][, string|null $onBehalfOfContentOwner = null ][, bool|null $sync = null ]) : PromiseInterface<string|int, Caption>

Costs 450 units of quota.

Parameters
$part : array<int, string>|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.

$body : Caption|array<string, mixed>

The Caption to send.

$media : Media|null = null

The file to upload: text/xml, application/octet-stream, /, up to 100 MB. Sent in the same request as the metadata.

$onBehalfOf : string|null = null

ID of the Google+ Page for the channel that the request is on behalf of.

$onBehalfOfContentOwner : string|null = null

Note: This parameter is intended exclusively for YouTube content partners. The 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.

$sync : bool|null = null

Extra parameter to allow automatically syncing the uploaded caption/transcript with the audio.

Tags
link
https://developers.google.com/youtube/v3/docs/captions/update
since
1.0.0
Return values
PromiseInterface<string|int, Caption>

call()

protected call(string $endpoint, string $method, string $path[, array<string, mixed> $query = [] ][, array<string, mixed>|JsonSerializable|null $body = null ][, string|null $returns = null ][, ?Media $media = null ][, ?string $uploadPath = null ][, bool $download = false ]) : PromiseInterface<string|int, mixed>
Parameters
$endpoint : string

The API method, e.g. liveChatMessages.list.

$method : string
$path : string
$query : array<string, mixed> = []
$body : array<string, mixed>|JsonSerializable|null = null
$returns : string|null = null

The type token the result hydrates as; null leaves it raw.

$media : ?Media = null
$uploadPath : ?string = null
$download : bool = false
Return values
PromiseInterface<string|int, mixed>

streamed()

Opens a server-streamed call and reads its body as it arrives.

protected streamed(string $endpoint, string $path, array<string, mixed> $query, string $returns) : PromiseInterface<string|int, ResponseStream>
Parameters
$endpoint : string
$path : string
$query : array<string, mixed>
$returns : string

The type token each element hydrates as.

Return values
PromiseInterface<string|int, ResponseStream>
On this page

Search results