Wallogit.com
2017 © Pedro Peláez
A PHP script to help download your videos from Youtube
A PHP script to help you download your videos from Youtube, (*1)
, (*2)
require_once 'vendor/autoload.php';
use PHPYoutubeDl\PHPYoutubeDl;
$php_youtube_dl = new PHPYoutubeDl("http://www.youtube.com/watch?v=xxxxxx");
$php_youtube_dl->startDownload();
require_once 'vendor/autoload.php';
use PHPYoutubeDl\PHPYoutubeDl;
$php_youtube_dl = new PHPYoutubeDl("http://www.youtube.com/watch?v=xxxxxx");
echo $php_youtube_dl->getDirectLink();
require_once 'vendor/autoload.php';
use PHPYoutubeDl\PHPYoutubeDl;
function showProgress($downloaded_size, $download_size){
echo $downloaded_size / $download_size;
echo PHP_EOL;
flush();
}
$php_youtube_dl = new PHPYoutubeDl("http://www.youtube.com/watch?v=xxxxxx");
$php_youtube_dl->setProgressCallback('showProgress');
$php_youtube_dl->startDownload();
Download the PHP script., (*3)
Make sure PHP-CLI is installed and added to your PATH variable., (*4)
php php-youtube-dl-cli.php -f 28 -t myvideo http://youtube.com/watch?v=xxxxxx
You can use the following arguments:, (*5)
| Option | Description |
|---|---|
| -c | Prints currently used JS cipher function. |
| -t title | Specify a custom filename. The video ID and the extension will still be appended to this argument. |
| -f format | Specify a format to download. You can access the list of available format IDs using the -l argument. |
| -l | Lists the available formats for the provided video. |
| -h | Prints the help section. |