PHP code example of exinfinite / ytc

1. Go to this page and download the library: Download exinfinite/ytc 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/ */

    

exinfinite / ytc example snippets


composer 

use Exinfinite\YTC\Agent;
use Exinfinite\YTC\PlaylistItems;
$apikey = "api-key";
$agent = new Agent($apikey, __DIR__ . '/cache');
$fetcher = new PlaylistItems($agent);

$playlistID = 'playlistID';
$data = $fetcher
        ->setPart(['snippet'])
        ->setPlaylistId($playlistID)
        ->setMaxResults(10)
        ->query(false);//true:ignore cache