jackal / video-downloader
This package is abandoned and no longer maintained.
No replacement package was suggested.
v0.5.2
2020-05-11 13:03 UTC
Requires
- php: >=7.1
- symfony/options-resolver: >=3.4
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.18
- phpunit/phpunit: ^7.5
README
This is the base project for actual downloader projects:
Installation
composer require jackal/video-downloader:^0.5
Write your own downloader:
class MyDownloader extends AbstractDownloader
{
public function getURL(): string
{
$videoId = $this->getVideoId();
//$videoLocation = [...code to retreive URL ...]
return $videoLocation;
}
//it needs to identify video ID from public URLS (this example: http://www.sample-site.com/video/1234/)
public static function getPublicUrlRegex(): string
{
return '/www\.sample-site\.com\/video\/([\d]+)\//';
}
public static function getType(): string
{
return 'my_downloader';
}
}
Download it!
$myVideoIdOrReference = '123456';
$vd = new \Jackal\Downloader\VideoDownloader();
$vd->registerDownloader(MyDownloader::class);
$downloader = $vd->getDownloader('my_downloader', $myVideoIdOrReference, [
//[...additional custom options...]
]);
$downloader->download(__DIR__ . '/output.avi');
Download from URL
$myVideoIdOrReference = '123456';
$vd = new \Jackal\Downloader\VideoDownloader();
$vd->registerDownloader(MyDownloader::class);
$downloader = $vd->getDownloaderByPublicUrl('http://www.sample-site.com/video/1234/', [
//[...additional custom options...]
]);
$downloader->download(__DIR__ . '/output.avi');