first commit
This commit is contained in:
35
public/youtube.php
Executable file
35
public/youtube.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?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";
|
||||
}
|
||||
Reference in New Issue
Block a user