35 lines
1.1 KiB
PHP
Executable File
35 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* This sample uploads and sets a custom thumbnail for a video.
|
|
*
|
|
* 1. It uploads an image using the "Google_MediaFileUpload" class.
|
|
* 2. It sets the uploaded image as a custom thumbnail to the video by
|
|
* calling the API's "youtube.thumbnails.set" method
|
|
*
|
|
* @author Ibrahim Ulukaya
|
|
*/
|
|
|
|
/**
|
|
* Library Requirements
|
|
*
|
|
* 1. Install composer (https://getcomposer.org)
|
|
* 2. On the command line, change to this directory (api-samples/php)
|
|
* 3. Require the google/apiclient library
|
|
* $ composer require google/apiclient:~2.0
|
|
*/
|
|
|
|
require_once dirname(__DIR__) . '/application/third_party/google/autoload.php';
|
|
|
|
|
|
$client = new Google_Client();
|
|
$client->setApplicationName("Client_Library_Examples");
|
|
$client->setDeveloperKey("AIzaSyBaJRWiXEAaFZtU0oJFzVYP4haGxXLFIP8");
|
|
|
|
$service = new Google_Service_YouTube_Video($client);
|
|
$optParams = array('filter' => 'free-ebooks');
|
|
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
|
|
|
|
foreach ($results as $item) {
|
|
echo $item['volumeInfo']['title'], "<br /> \n";
|
|
} |