-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
I want to search video by string/title but it throws a exception:
class Youtube
{
private Google_Service_YouTube $service;
public function __construct()
{
$client = new \Google_Client();
$client->setDeveloperKey(self::API_KEY);
$this->service = new \Google_Service_YouTube($client);
}
public function search($query)
{
$items = [];
$results = $this->service->search->listSearch($query);
foreach ($results->getItems() as $k => $item) {
$items[] = $item;
}
return $items;
}
}$youtube= new Youtube;
$youtube->search('video title');Google_Service_Exception : {
"error": {
"errors": [
{
"domain": "youtube.part",
"reason": "unknownPart",
"message": "video title",
"locationType": "parameter",
"location": "part"
}
],
"code": 400,
"message": "video title"
}
}
Metadata
Metadata
Assignees
Labels
No labels