YouTubePHP Documentation

SearchApi 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.

Searching for videos, channels and playlists. It has its own quota: 100 calls a day.

Reach it as $youtube->search. 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/search
since
1.0.0

Table of Contents

Properties

$youtube  : YouTube

Methods

__construct()  : mixed
list()  : PromiseInterface<string|int, SearchListResponse>
Retrieves a list of search resources
call()  : PromiseInterface<string|int, mixed>
streamed()  : PromiseInterface<string|int, ResponseStream>
Opens a server-streamed call and reads its body as it arrives.

Properties

Methods

list()

Retrieves a list of search resources

public list(array<int, string>|string $part[, string|null $channelId = null ][, string|null $channelType = null ][, string|null $eventType = null ][, bool|null $forContentOwner = null ][, bool|null $forDeveloper = null ][, bool|null $forMine = null ][, string|null $location = null ][, string|null $locationRadius = null ][, int|null $maxResults = null ][, string|null $onBehalfOfContentOwner = null ][, string|null $order = null ][, string|null $pageToken = null ][, DateTimeInterface|string|null $publishedAfter = null ][, DateTimeInterface|string|null $publishedBefore = null ][, string|null $q = null ][, string|null $regionCode = null ][, string|null $relevanceLanguage = null ][, string|null $safeSearch = null ][, string|null $topicId = null ][, array<int, string>|string|null $type = null ][, string|null $videoCaption = null ][, string|null $videoCategoryId = null ][, string|null $videoDefinition = null ][, string|null $videoDimension = null ][, string|null $videoDuration = null ][, string|null $videoEmbeddable = null ][, string|null $videoLicense = null ][, string|null $videoPaidProductPlacement = null ][, string|null $videoSyndicated = null ][, string|null $videoType = null ]) : PromiseInterface<string|int, SearchListResponse>

Costs 1 of the search quota's 100 calls a day, not the shared daily quota.

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

The part parameter specifies a comma-separated list of one or more search resource properties that the API response will include. Set the parameter value to snippet.

$channelId : string|null = null

Filter on resources belonging to this channelId. (Force TAP rebuild)

$channelType : string|null = null

Add a filter on the channel search. One of channelTypeUnspecified, any, show.

$eventType : string|null = null

Filter on the livestream status of the videos. One of none, upcoming, live, completed.

$forContentOwner : bool|null = null

Search owned by a content owner.

$forDeveloper : bool|null = null

Restrict the search to only retrieve videos uploaded using the project id of the authenticated user.

$forMine : bool|null = null

Search for the private videos of the authenticated user.

$location : string|null = null

Filter on location of the video

$locationRadius : string|null = null

Filter on distance from the location (specified above).

$maxResults : int|null = null

The maxResults parameter specifies the maximum number of items that should be returned in the result set. From 0 to 50. YouTube assumes 5 when it is left out.

$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 CMS account that the user authenticates with must be linked to the specified YouTube content owner.

$order : string|null = null

Sort order of the results. One of searchSortUnspecified, date, rating, viewCount, relevance, title, videoCount. YouTube assumes relevance when it is left out.

$pageToken : string|null = null

The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.

$publishedAfter : DateTimeInterface|string|null = null

Filter on resources published after this date.

$publishedBefore : DateTimeInterface|string|null = null

Filter on resources published before this date.

$q : string|null = null

Textual search terms to match.

$regionCode : string|null = null

Display the content as seen by viewers in this country.

$relevanceLanguage : string|null = null

Return results relevant to this language.

$safeSearch : string|null = null

Indicates whether the search results should include restricted content as well as standard content. One of safeSearchSettingUnspecified, none, moderate, strict. YouTube assumes moderate when it is left out.

$topicId : string|null = null

Restrict results to a particular topic.

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

Restrict results to a particular set of resource types from One Platform.

$videoCaption : string|null = null

Filter on the presence of captions on the videos. One of videoCaptionUnspecified, any, closedCaption, none.

$videoCategoryId : string|null = null

Filter on videos in a specific category.

$videoDefinition : string|null = null

Filter on the definition of the videos. One of any, standard, high.

$videoDimension : string|null = null

Filter on 3d videos. One of any, 2d, 3d.

$videoDuration : string|null = null

Filter on the duration of the videos. One of videoDurationUnspecified, any, short, medium, long.

$videoEmbeddable : string|null = null

Filter on embeddable videos. One of videoEmbeddableUnspecified, any, true.

$videoLicense : string|null = null

Filter on the license of the videos. One of any, youtube, creativeCommon.

$videoPaidProductPlacement : string|null = null

One of videoPaidProductPlacementUnspecified, any, true.

$videoSyndicated : string|null = null

Filter on syndicated videos. One of videoSyndicatedUnspecified, any, true.

$videoType : string|null = null

Filter on videos of a specific type. One of videoTypeUnspecified, any, movie, episode.

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

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