Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

lucajackal85/VideoDownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoDownloader

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