Recursive HTTP Live Streaming Downloader!
$ curl -sSL 'https://raw.githubusercontent.com/Ejz/HLSDownloader/master/i.sh' | sudo bash
$ hls-downloader-cli "http://ejz.ru/hls/hls-flat/trailer.m3u8"
/tmp/tmp.jYqtLR4pVQ
$ cd /tmp/tmp.jYqtLR4pVQ && find . -type f
./1280x7203.ts
./480x2705.ts
./1280x720.m3u8
./1280x7201.ts
./640x3603.ts
./480x270.m3u8
./640x3604.ts
./480x2703.ts
./480x2704.ts
./640x3601.ts
./640x3605.ts
./480x2702.ts
./trailer.m3u8
./480x2701.ts
./640x360.m3u8
./1280x7202.ts
./640x3602.ts
./1280x7205.ts
./1280x7204.ts
$ mkdir myproject && cd myproject
$ curl -sS 'https://getcomposer.org/installer' | php
$ php composer.phar require ejz/hls-downloader:~1.0
Let's test on an HLS file:
<?php
define('ROOT', __DIR__);
require(ROOT . '/vendor/autoload.php');
use Ejz\HLSDownloader;
$path = HLSDownloader::go("http://ejz.ru/hls/hls-flat/trailer.m3u8");
echo $path, "\n";
foreach(scandir($path) as $file)
echo $file, "\n";
Will output:
/tmp/tmp.oVCbca8212
.
..
1280x7201.ts
1280x7202.ts
1280x7203.ts
1280x7204.ts
1280x7205.ts
1280x720.m3u8
480x2701.ts
480x2702.ts
480x2703.ts
480x2704.ts
480x2705.ts
480x270.m3u8
640x3601.ts
640x3602.ts
640x3603.ts
640x3604.ts
640x3605.ts
640x360.m3u8
trailer.m3u8