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

This package is auto-updated.

Last update: 2024-07-13 21:14:51 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Build Status Scrutinizer Code Quality

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');