PHP code example of das-l / youtube-dl-bundle
1. Go to this page and download the library: Download das-l/youtube-dl-bundle 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/ */
das-l / youtube-dl-bundle example snippets
namespace App\Foo;
use YoutubeDl\Options;
use YoutubeDl\YoutubeDl;
class YouTubeFoo
{
private $youtubeDl;
public function __construct(YoutubeDl $youtubeDl)
{
$this->youtubeDl = $youtubeDl;
}
public function downloadVideo($downloadPath, $url)
{
$options = Options::create()
->downloadPath($downloadPath)
->url($url)
;
$collection = $this->youtubeDl->download($options);
// ...
}
}