PHP code example of mirazmac / youscrape

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

    

mirazmac / youscrape example snippets


use MirazMac\YouScrape\YouScrape;

$youtube = new YouScrape;

try {
    $videos = $youtube->videos('Honest Trailer');
} catch (\Exception $e) {
    echo $e->getMessage();
    exit;
}

print_r($videos->getAll());


use MirazMac\YouScrape\YouScrape;

$youtube = new YouScrape;

try {
    $single = $youtube->single('V7h01x1oiQs');
} catch (\Exception $e) {
    echo $e->getMessage();
    exit;
}

var_dump($single);


use MirazMac\YouScrape\YouScrape;

$youtube = new YouScrape;

try {
    $channels = $youtube->channels('Entertainment');
} catch (\Exception $e) {
    echo $e->getMessage();
    exit;
}

print_r($channels->getAll());


use MirazMac\YouScrape\YouScrape;

$youtube = new YouScrape;

try {
    $playlists = $youtube->playlists('Entertainment');
} catch (\Exception $e) {
    echo $e->getMessage();
    exit;
}

print_r($playlists->getAll());