1. Go to this page and download the library: Download igbas90/youtube-data-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
igbas90 / youtube-data-api example snippets
use Igbas90\YoutubeDataApi\YoutubeDataApi;
$dataApiClient = new YoutubeDataApi();
$commentsThreadClient = $dataApiClient->commentsThreadList;
use Igbas90\YoutubeDataApi\Services\CommentsThreadList;
$commentsThreadClient = new CommentsThreadList();
/** @var $dataApiClient Igbas90\YoutubeDataApi\YoutubeDataApi */
$dataApiClient->commentsThreadList->setApiKey('you google console api key');
$dataApiClient->subscriptionsList->setVideoId('9L9UQANH5oI');
/** @var $dataApiClient Igbas90\YoutubeDataApi\YoutubeDataApi */
$dataApiClient->commentsThreadList->setParams([
'apiKey' => "you google console api key",
'params' => [
'part' => ['part1', 'part2', ...],
'videoId' => 'string or array',
...
]
]);
use Igbas90\YoutubeDataApi\YoutubeDataApi;
$dataApiClient = new YoutubeDataApi([
'apiKey' => 'your google console api key',
'proxy' => 'http://username:password@ip:port',
'responseFormatter' => new ResponseFormatter()
]);
use Igbas90\YoutubeDataApi\YoutubeDataApi;
$dataApiClient = new YoutubeDataApi();
//set proxy
$dataApiClient->commentsThreadList->setProxy('http://username:password@ip:port');
//reset proxy
$dataApiClient->commentsThreadList->resetProxy();
use Igbas90\YoutubeDataApi\YoutubeDataApi;
$client = (new YoutubeDataApi())->commentsThreadList->setParams([...]);
$response = $client->setPageToken('pageToken')->request();