From df9f60339d6d1b6363cce1114903e39073dd887e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 7 Apr 2016 02:09:34 +0200 Subject: [PATCH 01/65] WIP stream --- composer.json | 3 +- composer.lock | 175 +++++++++++++++++++++++++++++++- controllers/FrontController.php | 32 ++++-- index.php | 4 +- templates/video.tpl | 37 ++++--- 5 files changed, 216 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index 86c5e22..9401c8d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,8 @@ "symfony/yaml": "~3.0.0", "symfony/process": "~3.0.0", "ffmpeg/ffmpeg": "~2.8.2", - "rudloff/smarty-plugin-noscheme": "~0.1.0" + "rudloff/smarty-plugin-noscheme": "~0.1.0", + "guzzlehttp/guzzle": "~6.2.0" }, "require-dev": { "symfony/var-dumper": "~3.0.0" diff --git a/composer.lock b/composer.lock index e589dc2..9c2c859 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "829ac07cae5bc43ef0ad3f5e5be618c5", - "content-hash": "a7131399bb03f78ba0dcfd8ab7e98d59", + "hash": "6ef0d5dc0640824fef3033cba540c6fb", + "content-hash": "dd3d8be96114267b553f77632c326e2c", "packages": [ { "name": "container-interop/container-interop", @@ -48,6 +48,177 @@ ], "type": "library" }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d094e337976dff9d8e2424e8485872194e768662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", + "reference": "d094e337976dff9d8e2424e8485872194e768662", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "~1.0", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.5.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-03-21 20:02:09" + }, + { + "name": "guzzlehttp/promises", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8", + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-03-08 01:15:46" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b", + "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-02-18 21:54:00" + }, { "name": "jeremykendall/php-domain-parser", "version": "3.0.0", diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 06f8188..6e734cd 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -103,11 +103,12 @@ class FrontController public static function video($request, $response) { global $container; + $params = $request->getQueryParams(); $config = Config::getInstance(); - if (isset($_GET["url"])) { - if (isset($_GET['audio'])) { + if (isset($params["url"])) { + if (isset($params['audio'])) { try { - $video = VideoDownload::getJSON($_GET["url"]); + $video = VideoDownload::getJSON($params["url"]); //Vimeo needs a correct user-agent $UA = VideoDownload::getUA(); @@ -168,7 +169,7 @@ class FrontController } } else { try { - $video = VideoDownload::getJSON($_GET["url"]); + $video = VideoDownload::getJSON($params["url"]); $container->view->render( $response, 'head.tpl', @@ -219,12 +220,22 @@ class FrontController public static function redirect($request, $response) { global $app; - if (isset($_GET["url"])) { + $params = $request->getQueryParams(); + if (isset($params["url"])) { try { - $video = VideoDownload::getURL($_GET["url"]); - return $response->withRedirect($video['url']); + $format = isset($params["format"]) ? $params["format"] : 'best'; + $video = VideoDownload::getJSON($params["url"], $format); + $client = new \GuzzleHttp\Client(); + $stream = $client->request('GET', $video->url, array('stream'=>true)); + $response = $response->withHeader('Content-Disposition', 'inline; filename="'.$video->_filename.'"'); + $response = $response->withHeader('Content-Type', $stream->getHeader('Content-Type')); + $response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length')); + if ($request->isGet()) { + $response = $response->withBody($stream->getBody()); + } + return $response; } catch (\Exception $e) { - echo $e->getMessage().PHP_EOL; + $response->getBody()->write($e->getMessage().PHP_EOL); return $response->withHeader('Content-Type', 'text/plain'); } } @@ -241,9 +252,10 @@ class FrontController public static function json($request, $response) { global $app; - if (isset($_GET["url"])) { + $params = $request->getQueryParams(); + if (isset($params["url"])) { try { - $video = VideoDownload::getJSON($_GET["url"]); + $video = VideoDownload::getJSON($params["url"]); return $response->withJson($video); } catch (\Exception $e) { return $response->withJson( diff --git a/index.php b/index.php index 468a685..c26d743 100644 --- a/index.php +++ b/index.php @@ -22,7 +22,7 @@ $container['view'] = function ($c) { $view = new \Slim\Views\Smarty(__DIR__.'/templates/'); $view->addSlimPlugins($c['router'], $c['request']->getUri()); - $view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme'); + $view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme'); return $view; @@ -43,7 +43,7 @@ $app->get( $app->get( '/redirect', array('Alltube\Controller\FrontController', 'redirect') -); +)->setName('redirect'); $app->get( '/json', array('Alltube\Controller\FrontController', 'json') diff --git a/templates/video.tpl b/templates/video.tpl index b6a1231..31c0b10 100644 --- a/templates/video.tpl +++ b/templates/video.tpl @@ -22,27 +22,24 @@ {/if}
- {if isset($video->formats)} -

Available formats:

-

(You might have to do a Right click > Save as)

-

+

+
+ +

+
+
{else} Date: Fri, 8 Apr 2016 22:58:42 +0200 Subject: [PATCH 02/65] Use smaller chunks (see https://github.com/slimphp/Slim/issues/1836) --- index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index de9387b..b7230d9 100644 --- a/index.php +++ b/index.php @@ -17,7 +17,13 @@ require_once __DIR__.'/vendor/rudloff/smarty-plugin-noscheme/modifier.noscheme.p use Alltube\VideoDownload; use Alltube\Controller\FrontController; -$app = new \Slim\App(); +$app = new \Slim\App( + array( + 'settings'=>array( + 'responseChunkSize'=>1024 + ) + ) +); $container = $app->getContainer(); $container['view'] = function ($c) { $view = new \Slim\Views\Smarty(__DIR__.'/templates/'); From 9354174b77375859ac02f3fd2d6cc9cdc9c7ab3f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Fri, 8 Apr 2016 23:01:07 +0200 Subject: [PATCH 03/65] Use bestaudio format if available --- controllers/FrontController.php | 125 +++++++++++++++++--------------- 1 file changed, 66 insertions(+), 59 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index aba76f5..663f255 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -115,58 +115,58 @@ class FrontController $video = $this->download->getJSON($params["url"]); //Vimeo needs a correct user-agent - $UA = $this->download->getUA(); ini_set( 'user_agent', - $UA + $video->http_headers->{'User-Agent'} ); $url_info = parse_url($video->url); - if ($url_info['scheme'] == 'rtmp') { - ob_end_flush(); - header( - 'Content-Disposition: attachment; filename="'. - html_entity_decode( - pathinfo( - $this->download->getFilename( - $video->webpage_url - ), - PATHINFO_FILENAME - ).'.mp3', - ENT_COMPAT, - 'ISO-8859-1' - ).'"' - ); - header("Content-Type: audio/mpeg"); - passthru( - '/usr/bin/rtmpdump -q -r '.escapeshellarg($video->url). - ' | '.$this->config->avconv. - ' -v quiet -i - -f mp3 -vn pipe:1' - ); - exit; - } else { - ob_end_flush(); - header( - 'Content-Disposition: attachment; filename="'. - html_entity_decode( - pathinfo( - $this->download->getFilename( - $video->webpage_url - ), - PATHINFO_FILENAME - ).'.mp3', - ENT_COMPAT, - 'ISO-8859-1' - ).'"' - ); - header("Content-Type: audio/mpeg"); - passthru( - 'curl '.$this->config->curl_params. - ' --user-agent '.escapeshellarg($UA). - ' '.escapeshellarg($video->url). - ' | '.$this->config->avconv. - ' -v quiet -i - -f mp3 -vn pipe:1' - ); - exit; + + try { + return $this->getStream($params["url"], 'bestaudio', $response, $request); + } catch (\Exception $e) { + if ($url_info['scheme'] == 'rtmp') { + ob_end_flush(); + header( + 'Content-Disposition: attachment; filename="'. + html_entity_decode( + pathinfo( + $video->_filename, + PATHINFO_FILENAME + ).'.mp3', + ENT_COMPAT, + 'ISO-8859-1' + ).'"' + ); + header("Content-Type: audio/mpeg"); + passthru( + '/usr/bin/rtmpdump -q -r '.escapeshellarg($video->url). + ' | '.$this->config->avconv. + ' -v quiet -i - -f mp3 -vn pipe:1' + ); + exit; + } else { + ob_end_flush(); + header( + 'Content-Disposition: attachment; filename="'. + html_entity_decode( + pathinfo( + $video->_filename, + PATHINFO_FILENAME + ).'.mp3', + ENT_COMPAT, + 'ISO-8859-1' + ).'"' + ); + header("Content-Type: audio/mpeg"); + passthru( + 'curl '.$this->config->curl_params. + ' --user-agent '.escapeshellarg($video->http_headers->{'User-Agent'}). + ' '.escapeshellarg($video->url). + ' | '.$this->config->avconv. + ' -v quiet -i - -f mp3 -vn pipe:1' + ); + exit; + } } } catch (\Exception $e) { $error = $e->getMessage(); @@ -213,6 +213,23 @@ class FrontController } } + private function getStream($url, $format, $response, $request) + { + if (!isset($format)) { + $format = 'best'; + } + $video = $this->download->getJSON($url, $format); + $client = new \GuzzleHttp\Client(); + $stream = $client->request('GET', $video->url, array('stream'=>true)); + $response = $response->withHeader('Content-Disposition', 'inline; filename="'.$video->_filename.'"'); + $response = $response->withHeader('Content-Type', $stream->getHeader('Content-Type')); + $response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length')); + if ($request->isGet()) { + $response = $response->withBody($stream->getBody()); + } + return $response; + } + /** * Redirect to video file * @@ -227,17 +244,7 @@ class FrontController $params = $request->getQueryParams(); if (isset($params["url"])) { try { - $format = isset($params["format"]) ? $params["format"] : 'best'; - $video = $this->download->getJSON($params["url"], $format); - $client = new \GuzzleHttp\Client(); - $stream = $client->request('GET', $video->url, array('stream'=>true)); - $response = $response->withHeader('Content-Disposition', 'inline; filename="'.$video->_filename.'"'); - $response = $response->withHeader('Content-Type', $stream->getHeader('Content-Type')); - $response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length')); - if ($request->isGet()) { - $response = $response->withBody($stream->getBody()); - } - return $response; + return $this->getStream($params["url"], $params["format"], $response, $request); } catch (\Exception $e) { $response->getBody()->write($e->getMessage().PHP_EOL); return $response->withHeader('Content-Type', 'text/plain'); From 734271c67c471807fab2fb7c8745b7438d7c61bc Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Fri, 8 Apr 2016 23:48:48 +0200 Subject: [PATCH 04/65] Download worst format --- templates/video.tpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/video.tpl b/templates/video.tpl index 31c0b10..e8291cc 100644 --- a/templates/video.tpl +++ b/templates/video.tpl @@ -30,7 +30,10 @@ - + + {foreach $video->formats as $format} Download
{/if} diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index c1053bd..bd5ebe7 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -176,6 +176,13 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase 'edgefcs.net', 'GRIP sucht den Sommerkönig-folge-203-0.mp3', ], + [ + //Only works on the feature/stream branch + 'https://twitter.com/verge/status/813055465324056576/video/1', null, + 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp4', + 'video.twimg.com', + 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp3', + ] ]; } From 3f96adb255ccc464af1f1073ed6fab18c6171051 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 26 Dec 2016 15:53:03 +0100 Subject: [PATCH 13/65] Lint --- classes/Config.php | 2 +- tests/VideoDownloadTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Config.php b/classes/Config.php index 14c42c0..5921a61 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -42,7 +42,7 @@ class Config '--no-playlist', '--no-warnings', //We can allow non-HTTP URLs on the feature/stream branch '-f best', - '--playlist-end', 1 + '--playlist-end', 1, ]; /** diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index bd5ebe7..a95a636 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -182,7 +182,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp4', 'video.twimg.com', 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp3', - ] + ], ]; } From 20820d90f0e001701f8294809e0be79f36771c4d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 26 Dec 2016 15:58:07 +0100 Subject: [PATCH 14/65] Missing doc --- classes/VideoDownload.php | 9 +++++++-- controllers/FrontController.php | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 18de6d5..d94dd85 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -293,6 +293,13 @@ class VideoDownload return popen($chain->getProcess()->getCommandLine(), 'r'); } + /** + * Get video stream from an M3U playlist. + * + * @param \stdClass $video Video object returned by getJSON + * + * @return resource popen stream + */ public function getM3uStream(\stdClass $video) { if (!shell_exec('which '.$this->config->avconv)) { @@ -312,8 +319,6 @@ class VideoDownload ] ); - //dump($procBuilder->getProcess()->getCommandLine()); die; - return popen($procBuilder->getProcess()->getCommandLine(), 'r'); } } diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 5f7ef09..b357d7d 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -217,6 +217,15 @@ class FrontController return $response->withStatus(500); } + /** + * Get a video/audio stream piped through the server. + * @param string $url URL of the video + * @param string $format Requested format + * @param Response $response PSR-7 response + * @param Request $request PSR-7 request + * @param string $password Video password + * @return Response + */ private function getStream($url, $format, $response, $request, $password = null) { if (!isset($format)) { From 0967bd6853901ecf5b6b4b5346a48269ef301c2e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 26 Dec 2016 15:59:16 +0100 Subject: [PATCH 15/65] Lint --- controllers/FrontController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index b357d7d..4c88bd1 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -219,11 +219,13 @@ class FrontController /** * Get a video/audio stream piped through the server. - * @param string $url URL of the video - * @param string $format Requested format - * @param Response $response PSR-7 response - * @param Request $request PSR-7 request - * @param string $password Video password + * + * @param string $url URL of the video + * @param string $format Requested format + * @param Response $response PSR-7 response + * @param Request $request PSR-7 request + * @param string $password Video password + * * @return Response */ private function getStream($url, $format, $response, $request, $password = null) From b730b51b21651acd387a4e0393d0071047098457 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 27 Dec 2016 00:10:18 +0100 Subject: [PATCH 16/65] Fix M3U test --- tests/VideoDownloadTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 1481793..5bb6af2 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -176,8 +176,18 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase 'edgefcs.net', 'GRIP sucht den Sommerkönig-folge-203-0.mp3', ], + ]; + } + + /** + * Provides M3U8 URLs for tests. + * + * @return array[] + */ + public function M3uUrlProvider() + { + return [ [ - //Only works on the feature/stream branch 'https://twitter.com/verge/status/813055465324056576/video/1', null, 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp4', 'video.twimg.com', @@ -206,6 +216,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider URLProvider + * @dataProvider M3uUrlProvider */ public function testGetJSON($url, $format) { @@ -241,6 +252,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider urlProvider + * @dataProvider M3uUrlProvider */ public function testGetFilename($url, $format, $filename) { @@ -273,6 +285,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider urlProvider + * @dataProvider M3uUrlProvider */ public function testGetAudioFilename($url, $format, $filename, $domain, $audioFilename) { From ef366dc6d101edc8b5435b67c10ccbf0f2ef8e80 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 27 Dec 2016 00:36:30 +0100 Subject: [PATCH 17/65] Add tests for getM3uStream() --- tests/VideoDownloadTest.php | 43 +++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 5bb6af2..4cd580d 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -347,11 +347,50 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase /** * Test getAudioStream function with a M3U8 file. * + * @param string $url URL + * @param string $format Format + * * @return void * @expectedException Exception + * @dataProvider M3uUrlProvider */ - public function testGetAudioStreamM3uError() + public function testGetAudioStreamM3uError($url, $format) { - $this->download->getAudioStream('https://twitter.com/verge/status/813055465324056576/video/1', 'best'); + $this->download->getAudioStream($url, $format); + } + + /** + * Test getM3uStream function. + * + * @param string $url URL + * @param string $format Format + * + * @return void + * @dataProvider M3uUrlProvider + */ + public function testGetM3uStream($url, $format) + { + $video = $this->download->getJSON($url, $format); + $stream = $this->download->getM3uStream($video); + $this->assertInternalType('resource', $stream); + $this->assertFalse(feof($stream)); + } + + /** + * Test getM3uStream function without avconv. + * + * @param string $url URL + * @param string $format Format + * + * @return void + * @expectedException Exception + * @dataProvider M3uUrlProvider + */ + public function testGetM3uStreamAvconvError($url, $format) + { + $config = \Alltube\Config::getInstance(); + $config->avconv = 'foobar'; + $video = $this->download->getJSON($url, $format); + $this->download->getM3uStream($video); } } From abcfbfbb2b2686da96bd5d93da11ba18dfc48cfa Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 11 Jan 2017 12:29:31 +0100 Subject: [PATCH 18/65] Add ugly URLs to FAQ --- FAQ.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/FAQ.md b/FAQ.md index 6331183..3ed1185 100644 --- a/FAQ.md +++ b/FAQ.md @@ -71,3 +71,12 @@ You need to either: * Use a [release package](https://github.com/Rudloff/alltube/releases) * Run `npm install` (see detailed instructions in the [README](README.md#from-git)) + +## I get a 404 error on every page except the index + +This is probably because your server does not have mod_rewrite or AllowOverride is disabled. +You can work around this by adding this to your `config.yml` file: + +```yaml +uglyUrls: true +``` From fd14ade72573b0af64e12310f7ac29710cd37f56 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 11 Jan 2017 12:31:21 +0100 Subject: [PATCH 19/65] Escape variables and filenames in FAQ --- FAQ.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FAQ.md b/FAQ.md index 3ed1185..af5eb54 100644 --- a/FAQ.md +++ b/FAQ.md @@ -12,15 +12,15 @@ You can ususally download the video by doing *File > Save to* or *ctrl + S*. You need to create a YAML file called `config.yml` at the root of your project. Here are the parameters that you can set: -* youtubedl: path to your youtube-dl binary -* python: path to your python binary -* params: an array of parameters to pass to youtube-dl -* curl_params: an array of parameters to pass to curl -* convert: true to enable audio conversion -* avconv: path to your avconv or ffmpeg binary -* rtmpdump: path to your rtmpdump binary +* `youtubedl`: path to your youtube-dl binary +* `python`: path to your python binary +* `params`: an array of parameters to pass to youtube-dl +* `curl_params`: an array of parameters to pass to curl +* `convert`: true to enable audio conversion +* `avconv`: path to your avconv or ffmpeg binary +* `rtmpdump`: path to your rtmpdump binary -See [config.example.yml](config.example.yml) for default values. +See [`config.example.yml`](config.example.yml) for default values. ## How do I enable audio conversion? From 686a0896f8ed23093832109b26b7e5e8b30cdb7b Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 14 Jan 2017 23:38:06 +0100 Subject: [PATCH 20/65] youtube-dl update Symfony update --- composer.json | 6 +++--- composer.lock | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 3d91719..d4ed25a 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.7.2", "ffmpeg/ffmpeg": "dev-release", - "rg3/youtube-dl": "~2017.01.10", + "rg3/youtube-dl": "~2017.01.14", "rudloff/rtmpdump-bin": "~2.3", "heroku/heroku-buildpack-php": "*" }, @@ -35,10 +35,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.01.10", + "version": "2017.01.14", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.10.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.14.zip" } } }, diff --git a/composer.lock b/composer.lock index f9f96e3..24e660f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "16268cc5135ed42aedf75446f4e39bd7", + "content-hash": "15507d8a1cb225e2e118500a7883b255", "packages": [ { "name": "aura/session", @@ -612,16 +612,16 @@ }, { "name": "symfony/process", - "version": "v3.2.1", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3" + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3", - "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3", + "url": "https://api.github.com/repos/symfony/process/zipball/350e810019fc52dd06ae844b6a6d382f8a0e8893", + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893", "shasum": "" }, "require": { @@ -657,20 +657,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-11-24T10:40:28+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/yaml", - "version": "v3.2.1", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f" + "reference": "50eadbd7926e31842893c957eca362b21592a97d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f", + "url": "https://api.github.com/repos/symfony/yaml/zipball/50eadbd7926e31842893c957eca362b21592a97d", + "reference": "50eadbd7926e31842893c957eca362b21592a97d", "shasum": "" }, "require": { @@ -712,7 +712,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-12-10T10:07:06+00:00" + "time": "2017-01-03T13:51:32+00:00" } ], "packages-dev": [ @@ -1466,10 +1466,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.01.10", + "version": "2017.01.14", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.10.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.14.zip", "reference": null, "shasum": null }, @@ -2155,16 +2155,16 @@ }, { "name": "symfony/var-dumper", - "version": "v3.2.1", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0" + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f722532b0966e9b6fc631e682143c07b2cf583a0", - "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b54b23f9a19b465e76fdaac0f6732410467c83b2", + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2", "shasum": "" }, "require": { @@ -2214,7 +2214,7 @@ "debug", "dump" ], - "time": "2016-12-11T14:34:22+00:00" + "time": "2017-01-03T08:53:57+00:00" }, { "name": "webmozart/assert", From d1e744e42cf0290590d6a19c275056daaa3ab63f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 01:57:44 +0100 Subject: [PATCH 21/65] Fix bookmarklet URL (fix #90 and #89) --- controllers/FrontController.php | 2 ++ templates/index.tpl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 04734da..91900c0 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -80,6 +80,7 @@ class FrontController */ public function index(Request $request, Response $response) { + $uri = $request->getUri(); $this->view->render( $response, 'index.tpl', @@ -88,6 +89,7 @@ class FrontController 'uglyUrls' => $this->config->uglyUrls, 'class' => 'index', 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.', + 'domain' => $uri->getScheme().'://'.$uri->getAuthority(), ] ); } diff --git a/templates/index.tpl b/templates/index.tpl index 66eb1ab..d16f6f0 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -28,7 +28,7 @@ See all supported websites

Drag this to your bookmarks bar:

- Bookmarklet + Bookmarklet
From d96a1e48673122aec860d137fb37d24ab4240f38 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 11:23:47 +0100 Subject: [PATCH 22/65] Fix M3U tests --- tests/VideoDownloadTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index cdec782..3c5d760 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -189,9 +189,9 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase return [ [ 'https://twitter.com/verge/status/813055465324056576/video/1', null, - 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp4', + 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576', + 'mp4', 'video.twimg.com', - 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576.mp3', ], ]; } From 4e1c1ca9532b28b20ddcf55290d5d17532b700cd Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 11:29:56 +0100 Subject: [PATCH 23/65] Add a stream parameter in config (fixes #24 and #39) --- classes/Config.php | 13 +++++----- config.example.yml | 2 +- controllers/FrontController.php | 46 ++++++++++++++++++++++++++------- templates/video.tpl | 8 +++--- tests/VideoDownloadTest.php | 11 ++++---- 5 files changed, 56 insertions(+), 24 deletions(-) diff --git a/classes/Config.php b/classes/Config.php index 0482e36..72779b8 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -38,12 +38,7 @@ class Config * * @var array */ - public $params = [ - '--no-playlist', '--no-warnings', - //We can allow non-HTTP URLs on the feature/stream branch - '-f best', - '--playlist-end', 1, - ]; + public $params = ['--no-playlist', '--no-warnings', '--playlist-end', 1]; /** * Enable audio conversion. @@ -87,6 +82,12 @@ class Config */ public $uglyUrls = false; + /** + * Stream downloaded files trough server? + * @var boolean + */ + public $stream = false; + /** * YAML config file path. * diff --git a/config.example.yml b/config.example.yml index 7fb80ef..6bb93e4 100644 --- a/config.example.yml +++ b/config.example.yml @@ -3,7 +3,6 @@ python: /usr/bin/python params: - --no-playlist - --no-warnings - - -f best[protocol^=http] - --playlist-end - 1 curl_params: @@ -12,3 +11,4 @@ avconv: vendor/bin/ffmpeg rtmpdump: vendor/bin/rtmpdump curl: /usr/bin/curl uglyUrls: false +stream: false diff --git a/controllers/FrontController.php b/controllers/FrontController.php index cc71335..0c101b8 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -68,6 +68,11 @@ class FrontController $session_factory = new \Aura\Session\SessionFactory(); $session = $session_factory->newInstance($_COOKIE); $this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController'); + if ($this->config->stream) { + $this->defaultFormat = 'best'; + } else { + $this->defaultFormat = 'best[protocol^=http]'; + } } /** @@ -156,7 +161,13 @@ class FrontController } if (isset($params['audio'])) { try { - return $this->getStream($params['url'], 'mp3', $response, $request, $password); + if ($this->config->stream) { + return $this->getStream($params['url'], 'mp3', $response, $request, $password); + } else { + $url = $this->download->getURL($params['url'], 'mp3[protocol^=http]', $password); + + return $response->withRedirect($url); + } } catch (PasswordException $e) { return $this->password($request, $response); } catch (\Exception $e) { @@ -176,10 +187,15 @@ class FrontController } } else { try { - $video = $this->download->getJSON($params['url'], null, $password); + $video = $this->download->getJSON($params['url'], $this->defaultFormat, $password); } catch (PasswordException $e) { return $this->password($request, $response); } + if ($this->config->stream) { + $protocol = ''; + } else { + $protocol = '[protocol^=http]'; + } $this->view->render( $response, 'video.tpl', @@ -188,6 +204,8 @@ class FrontController 'class' => 'video', 'title' => $video->title, 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, + 'protocol' => $protocol, + 'config' => $this->config, ] ); } @@ -270,13 +288,23 @@ class FrontController $params = $request->getQueryParams(); if (isset($params['url'])) { try { - return $this->getStream( - $params['url'], - $request->getParam('format'), - $response, - $request, - $this->sessionSegment->getFlash($params['url']) - ); + if ($this->config->stream) { + return $this->getStream( + $params['url'], + $request->getParam('format'), + $response, + $request, + $this->sessionSegment->getFlash($params['url']) + ); + } else { + $url = $this->download->getURL( + $params['url'], + $request->getParam('format'), + $this->sessionSegment->getFlash($params['url']) + ); + + return $response->withRedirect($url); + } } catch (PasswordException $e) { return $response->withRedirect( $this->container->get('router')->pathFor('video').'?url='.urlencode($params['url']) diff --git a/templates/video.tpl b/templates/video.tpl index 85a4a25..5b82363 100644 --- a/templates/video.tpl +++ b/templates/video.tpl @@ -29,17 +29,18 @@ {/if}


{else} - + Download
{/if} diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 3c5d760..202e858 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -146,7 +146,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase { return [ [ - 'https://www.youtube.com/watch?v=M7IpKCZ47pU', null, + 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'best[protocol^=http]', "It's Not Me, It's You - Hearts Under Fire-M7IpKCZ47pU", 'mp4', 'googlevideo.com', @@ -159,7 +159,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase 'googlevideo.com', ], [ - 'https://vimeo.com/24195442', null, + 'https://vimeo.com/24195442', 'best[protocol^=http]', 'Carving the Mountains-24195442', 'mp4', 'vimeocdn.com', @@ -188,7 +188,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase { return [ [ - 'https://twitter.com/verge/status/813055465324056576/video/1', null, + 'https://twitter.com/verge/status/813055465324056576/video/1', 'best', 'The Verge - This tiny origami robot can self-fold and complete tasks-813055465324056576', 'mp4', 'video.twimg.com', @@ -225,6 +225,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase $this->assertObjectHasAttribute('url', $info); $this->assertObjectHasAttribute('ext', $info); $this->assertObjectHasAttribute('title', $info); + $this->assertObjectHasAttribute('extractor_key', $info); $this->assertObjectHasAttribute('formats', $info); $this->assertObjectHasAttribute('_filename', $info); } @@ -322,7 +323,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase */ public function testGetAudioStreamAvconvError($url, $format) { - $config = \Alltube\Config::getInstance(); + $config = Config::getInstance(); $config->avconv = 'foobar'; $this->download->getAudioStream($url, $format); } @@ -339,7 +340,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase */ public function testGetAudioStreamCurlError($url, $format) { - $config = \Alltube\Config::getInstance(); + $config = Config::getInstance(); $config->curl = 'foobar'; $config->rtmpdump = 'foobar'; $this->download->getAudioStream($url, $format); From 13e55cbfaebfa6b1a1c8cab51ea24c747aeb1638 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 12:09:25 +0100 Subject: [PATCH 24/65] Add stream to FAQ --- FAQ.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/FAQ.md b/FAQ.md index af5eb54..5600add 100644 --- a/FAQ.md +++ b/FAQ.md @@ -80,3 +80,25 @@ You can work around this by adding this to your `config.yml` file: ```yaml uglyUrls: true ``` + +## How do I enable streaming videos through the server? + +You need to add this to your `config.yml` file: + +```yaml +stream: true +``` + +Note that this can use a lot of ressources on your server. + +## I want to download M3U videos + +You need to enable streaming (see above). + +## The downloaded videos have a strange name like `videoplayback.mp4` + +Alltube can rename videos automatically if you enable streaming (see above). + +## I want to download a video that isn't available in my country + +If the video is available in the server's country, you can download it if you enable streaming (see above). From f309fc70333ac1df124fb3fa32f54fb38f9e10a1 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 12:11:37 +0100 Subject: [PATCH 25/65] Lint --- classes/Config.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/Config.php b/classes/Config.php index 72779b8..0c3fde3 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -84,7 +84,8 @@ class Config /** * Stream downloaded files trough server? - * @var boolean + * + * @var bool */ public $stream = false; From 7b48dbfd94b37b806d501cf5545028281410e539 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 12:14:57 +0100 Subject: [PATCH 26/65] Escape canonical URL --- templates/inc/head.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/inc/head.tpl b/templates/inc/head.tpl index bf20a4c..9a44d22 100644 --- a/templates/inc/head.tpl +++ b/templates/inc/head.tpl @@ -10,7 +10,7 @@ {/if} AllTube Download{if isset($title)} - {$title|escape}{/if} - + From 929123c08e6d58179b395b32671a75fb350a2df5 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 12:21:38 +0100 Subject: [PATCH 27/65] Easier way to create a mock request for tests --- tests/UglyRouterTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/UglyRouterTest.php b/tests/UglyRouterTest.php index 3d211c5..874bca2 100644 --- a/tests/UglyRouterTest.php +++ b/tests/UglyRouterTest.php @@ -43,13 +43,13 @@ class UglyRouterTest extends \PHPUnit_Framework_TestCase $this->assertEquals( [1, 'route0', []], $this->router->dispatch( - new Request( - 'GET', - Uri::createFromString('http://example.com/?page=foo'), - Headers::createFromEnvironment(new Environment()), - [], - [], - new Stream(fopen('php://temp', 'r')) + Request::createFromEnvironment( + Environment::mock( + [ + 'REQUEST_METHOD' => 'GET', + 'QUERY_STRING'=>'page=foo' + ] + ) ) ) ); From d709e7c9a9ea4a2e5775da14451e03781ab988d9 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 11:23:43 +0000 Subject: [PATCH 28/65] Apply fixes from StyleCI --- tests/UglyRouterTest.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/UglyRouterTest.php b/tests/UglyRouterTest.php index 874bca2..4d21b3e 100644 --- a/tests/UglyRouterTest.php +++ b/tests/UglyRouterTest.php @@ -7,10 +7,7 @@ namespace Alltube\Test; use Alltube\UglyRouter; use Slim\Http\Environment; -use Slim\Http\Headers; use Slim\Http\Request; -use Slim\Http\Stream; -use Slim\Http\Uri; /** * Unit tests for the UglyRouter class. @@ -47,7 +44,7 @@ class UglyRouterTest extends \PHPUnit_Framework_TestCase Environment::mock( [ 'REQUEST_METHOD' => 'GET', - 'QUERY_STRING'=>'page=foo' + 'QUERY_STRING' => 'page=foo', ] ) ) From 5ce84badecfaa2560d7a9b3804702c2f5f885c91 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 13:43:47 +0100 Subject: [PATCH 29/65] Refactor controller --- controllers/FrontController.php | 120 +++++++++++++++++++------------- 1 file changed, 73 insertions(+), 47 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 0c101b8..c96ad7a 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -143,6 +143,77 @@ class FrontController ); } + /** + * Return the converted MP3 file + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * @return Response + */ + private function getAudioResponse(Request $request, Response $response, array $params, $password = null) + { + try { + if ($this->config->stream) { + return $this->getStream($params['url'], 'mp3', $response, $request, $password); + } else { + $url = $this->download->getURL($params['url'], 'mp3[protocol^=http]', $password); + + return $response->withRedirect($url); + } + } catch (PasswordException $e) { + return $this->password($request, $response); + } catch (\Exception $e) { + $response = $response->withHeader( + 'Content-Disposition', + 'attachment; filename="'. + $this->download->getAudioFilename($params['url'], 'bestaudio/best', $password).'"' + ); + $response = $response->withHeader('Content-Type', 'audio/mpeg'); + + if ($request->isGet() || $request->isPost()) { + $process = $this->download->getAudioStream($params['url'], 'bestaudio/best', $password); + $response = $response->withBody(new Stream($process)); + } + + return $response; + } + } + + /** + * Return the video description page + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * @return Response + */ + private function getVideoResponse(Request $request, Response $response, array $params, $password = null) + { + try { + $video = $this->download->getJSON($params['url'], $this->defaultFormat, $password); + } catch (PasswordException $e) { + return $this->password($request, $response); + } + if ($this->config->stream) { + $protocol = ''; + } else { + $protocol = '[protocol^=http]'; + } + $this->view->render( + $response, + 'video.tpl', + [ + 'video' => $video, + 'class' => 'video', + 'title' => $video->title, + 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, + 'protocol' => $protocol, + 'config' => $this->config, + ] + ); + } + /** * Dislay information about the video. * @@ -160,54 +231,9 @@ class FrontController $this->sessionSegment->setFlash($params['url'], $password); } if (isset($params['audio'])) { - try { - if ($this->config->stream) { - return $this->getStream($params['url'], 'mp3', $response, $request, $password); - } else { - $url = $this->download->getURL($params['url'], 'mp3[protocol^=http]', $password); - - return $response->withRedirect($url); - } - } catch (PasswordException $e) { - return $this->password($request, $response); - } catch (\Exception $e) { - $response = $response->withHeader( - 'Content-Disposition', - 'attachment; filename="'. - $this->download->getAudioFilename($params['url'], 'bestaudio/best', $password).'"' - ); - $response = $response->withHeader('Content-Type', 'audio/mpeg'); - - if ($request->isGet() || $request->isPost()) { - $process = $this->download->getAudioStream($params['url'], 'bestaudio/best', $password); - $response = $response->withBody(new Stream($process)); - } - - return $response; - } + return $this->getAudioResponse($request, $response, $params, $password); } else { - try { - $video = $this->download->getJSON($params['url'], $this->defaultFormat, $password); - } catch (PasswordException $e) { - return $this->password($request, $response); - } - if ($this->config->stream) { - $protocol = ''; - } else { - $protocol = '[protocol^=http]'; - } - $this->view->render( - $response, - 'video.tpl', - [ - 'video' => $video, - 'class' => 'video', - 'title' => $video->title, - 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, - 'protocol' => $protocol, - 'config' => $this->config, - ] - ); + return $this->getVideoResponse($request, $response, $params, $password); } } else { return $response->withRedirect($this->container->get('router')->pathFor('index')); From b7f9e9570dc1cef57d6fa01404340dd4019e1702 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 13:47:29 +0100 Subject: [PATCH 30/65] Function name should be in camel case --- tests/VideoDownloadTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 202e858..3744305 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -184,7 +184,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return array[] */ - public function M3uUrlProvider() + public function m3uUrlProvider() { return [ [ @@ -216,7 +216,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider URLProvider - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetJSON($url, $format) { @@ -254,7 +254,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider urlProvider - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetFilename($url, $format, $filename, $extension) { @@ -287,7 +287,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @dataProvider urlProvider - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetAudioFilename($url, $format, $filename) { @@ -354,7 +354,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @expectedException Exception - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetAudioStreamM3uError($url, $format) { @@ -368,7 +368,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * @param string $format Format * * @return void - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetM3uStream($url, $format) { @@ -386,7 +386,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * * @return void * @expectedException Exception - * @dataProvider M3uUrlProvider + * @dataProvider m3uUrlProvider */ public function testGetM3uStreamAvconvError($url, $format) { From bb7050cf750820a79e950ab97848c15622511e7f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 14:22:15 +0100 Subject: [PATCH 31/65] Fix ugly URLs condition --- templates/index.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.tpl b/templates/index.tpl index d16f6f0..9f3583c 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -12,7 +12,7 @@ - {if uglyUrls} + {if $uglyUrls} {/if}
From ec250b0d059370c066288a34ece2aaa1c1b1aa96 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 14:26:12 +0100 Subject: [PATCH 32/65] Cleaner way to get canonical URL --- controllers/FrontController.php | 34 ++++++++++++++++++++++++++++++--- templates/inc/head.tpl | 2 +- tests/FrontControllerTest.php | 0 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 tests/FrontControllerTest.php diff --git a/controllers/FrontController.php b/controllers/FrontController.php index c96ad7a..649a061 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -95,6 +95,7 @@ class FrontController 'class' => 'index', 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.', 'domain' => $uri->getScheme().'://'.$uri->getAuthority(), + 'canonical' => $this->getCanonicalUrl($request), ] ); } @@ -118,6 +119,7 @@ class FrontController 'title' => 'Supported websites', 'description' => 'List of all supported websites from which Alltube Download '. 'can extract video or audio files', + 'canonical' => $this->getCanonicalUrl($request), ] ); } @@ -139,6 +141,7 @@ class FrontController 'class' => 'password', 'title' => 'Password prompt', 'description' => 'You need a password in order to download this video with Alltube Download', + 'canonical' => $this->getCanonicalUrl($request), ] ); } @@ -210,6 +213,7 @@ class FrontController 'description' => 'Download "'.$video->title.'" from '.$video->extractor_key, 'protocol' => $protocol, 'config' => $this->config, + 'canonical' => $this->getCanonicalUrl($request), ] ); } @@ -255,9 +259,10 @@ class FrontController $response, 'error.tpl', [ - 'errors' => $exception->getMessage(), - 'class' => 'video', - 'title' => 'Error', + 'errors' => $exception->getMessage(), + 'class' => 'video', + 'title' => 'Error', + 'canonical' => $this->getCanonicalUrl($request), ] ); @@ -366,4 +371,27 @@ class FrontController } } } + + /** + * Generate the canonical URL of the current page + * @param Request $request PSR-7 Request + * @return string URL + */ + private function getCanonicalUrl(Request $request) + { + $uri = $request->getUri(); + $return = 'https://alltubedownload.net/'; + + $path = $uri->getPath(); + if ($path != '/') { + $return .= $path; + } + + $query = $uri->getQuery(); + if (!empty($query)) { + $return .= '?'.$query; + } + + return $return; + } } diff --git a/templates/inc/head.tpl b/templates/inc/head.tpl index 9a44d22..98a0784 100644 --- a/templates/inc/head.tpl +++ b/templates/inc/head.tpl @@ -10,7 +10,7 @@ {/if} AllTube Download{if isset($title)} - {$title|escape}{/if} - + diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php new file mode 100644 index 0000000..e69de29 From 5e09d8adc76d8093a082adb4eef9b9477fb5cd0d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 16:03:31 +0100 Subject: [PATCH 33/65] Remove JSON output as we don't use it anymore --- controllers/FrontController.php | 23 ----------------------- index.php | 4 ---- 2 files changed, 27 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 649a061..a9d9115 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -348,29 +348,6 @@ class FrontController } } - /** - * Output JSON info about the video. - * - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * - * @return Response HTTP response - */ - public function json(Request $request, Response $response) - { - $params = $request->getQueryParams(); - if (isset($params['url'])) { - try { - $video = $this->download->getJSON($params['url']); - - return $response->withJson($video); - } catch (\Exception $e) { - return $response->withJson( - ['success' => false, 'error' => $e->getMessage()] - ); - } - } - } /** * Generate the canonical URL of the current page diff --git a/index.php b/index.php index fad0bb0..b3b77de 100644 --- a/index.php +++ b/index.php @@ -48,8 +48,4 @@ $app->get( '/redirect', [$controller, 'redirect'] )->setName('redirect'); -$app->get( - '/json', - [$controller, 'json'] -); $app->run(); From 16e1f9d6db29ac6e8c3d935f93f49b2466ee752c Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 17:19:19 +0100 Subject: [PATCH 34/65] Test controller --- controllers/FrontController.php | 8 +- phpunit.xml | 3 +- tests/FrontControllerTest.php | 307 ++++++++++++++++++++++++++++++++ tests/bootstrap.php | 11 ++ 4 files changed, 327 insertions(+), 2 deletions(-) create mode 100644 tests/bootstrap.php diff --git a/controllers/FrontController.php b/controllers/FrontController.php index a9d9115..2126211 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -98,6 +98,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** @@ -122,6 +123,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** @@ -144,6 +146,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** @@ -216,6 +219,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** @@ -343,8 +347,10 @@ class FrontController } catch (\Exception $e) { $response->getBody()->write($e->getMessage()); - return $response->withHeader('Content-Type', 'text/plain'); + return $response->withHeader('Content-Type', 'text/plain')->withStatus(500); } + } else { + return $response->withRedirect($this->container->get('router')->pathFor('index')); } } diff --git a/phpunit.xml b/phpunit.xml index fe96cd9..f37d2a5 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,8 @@ - + classes/ + controllers/ diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index e69de29..f04d9d5 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -0,0 +1,307 @@ +container = new Container(); + $this->request = Request::createFromEnvironment(Environment::mock()); + $this->response = new Response(); + $this->container['view'] = function ($c) { + $view = new \Slim\Views\Smarty(__DIR__.'/../templates/'); + + $smartyPlugins = new \Slim\Views\SmartyPlugins($c['router'], $this->request->getUri()); + $view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']); + $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']); + + $view->registerPlugin('modifier', 'noscheme', 'Smarty_Modifier_noscheme'); + + return $view; + }; + $this->controller = new FrontController($this->container); + $this->container['router']->map(['GET'], '/', [$this->controller, 'index']) + ->setName('index'); + $this->container['router']->map(['GET'], '/video', [$this->controller, 'video']) + ->setName('video'); + $this->container['router']->map(['GET'], '/extractors', [$this->controller, 'extractors']) + ->setName('extractors'); + $this->container['router']->map(['GET'], '/redirect', [$this->controller, 'redirect']) + ->setName('redirect'); + } + + /** + * Destroy properties after test. + */ + protected function tearDown() + { + Config::destroyInstance(); + } + + /** + * Test the constructor with streams enabled + * @return void + */ + public function testConstructorWithStream() + { + $config = Config::getInstance(); + $config->stream = true; + $controller = new FrontController($this->container); + $this->assertInstanceOf(FrontController::class, $controller); + } + + /** + * Test the index() function + * @return void + */ + public function testIndex() + { + $result = $this->controller->index($this->request, $this->response); + $this->assertTrue($result->isOk()); + } + + /** + * Test the index() function with a custom URI + * @return void + */ + public function testIndexWithCustomUri() + { + $result = $this->controller->index( + Request::createFromEnvironment( + Environment::mock(['REQUEST_URI'=>'/foo', 'QUERY_STRING'=>'foo=bar']) + ), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the extractors() function + * @return void + */ + public function testExtractors() + { + $result = $this->controller->extractors($this->request, $this->response); + $this->assertTrue($result->isOk()); + } + + /** + * Test the password() function + * @return void + */ + public function testPassword() + { + $result = $this->controller->password($this->request, $this->response); + $this->assertTrue($result->isOk()); + } + + /** + * Test the video() function without the url parameter + * @return void + */ + public function testVideoWithoutUrl() + { + $result = $this->controller->video($this->request, $this->response); + $this->assertTrue($result->isRedirect()); + } + + /** + * Test the video() function + * @return void + */ + public function testVideo() + { + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the video() function with audio conversion + * @return void + */ + public function testVideoWithAudio() + { + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio'=>true]), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the video() function with audio enabled and an URL that doesn't need to be converted + * @return void + */ + public function testVideoWithUnconvertedAudio() + { + $result = $this->controller->video( + $this->request->withQueryParams( + ['url'=>'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', + 'audio'=>true] + ), + $this->response + ); + $this->assertTrue($result->isRedirect()); + } + + /** + * Test the video() function with a password + * @return void + */ + public function testVideoWithPassword() + { + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'http://vimeo.com/68375962']) + ->withParsedBody(['password'=>'youtube-dl']), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the video() function with a missing password + * @return void + */ + public function testVideoWithMissingPassword() + { + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'http://vimeo.com/68375962']), + $this->response + ); + $this->assertTrue($result->isOk()); + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'http://vimeo.com/68375962', 'audio'=>true]), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the video() function with streams enabled + * @return void + */ + public function testVideoWithStream() + { + $config = Config::getInstance(); + $config->stream = true; + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']), + $this->response + ); + $this->assertTrue($result->isOk()); + $result = $this->controller->video( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio'=>true]), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the error() function + * @return void + */ + public function testError() + { + $result = $this->controller->error($this->request, $this->response, new \Exception('foo')); + $this->assertTrue($result->isServerError()); + } + + /** + * Test the redirect() function without the URL parameter + * @return void + */ + public function testRedirectWithoutUrl() + { + $result = $this->controller->redirect($this->request, $this->response); + $this->assertTrue($result->isRedirect()); + } + + /** + * Test the redirect() function + * @return void + */ + public function testRedirect() + { + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']), + $this->response + ); + $this->assertTrue($result->isRedirect()); + } + + /** + * Test the redirect() function with streams enabled + * @return void + */ + public function testRedirectWithStream() + { + $config = Config::getInstance(); + $config->stream = true; + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the redirect() function with an M3U stream + * @return void + */ + public function testRedirectWithM3uStream() + { + $config = Config::getInstance(); + $config->stream = true; + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']), + $this->response + ); + $this->assertTrue($result->isOk()); + } + + /** + * Test the redirect() function with a missing password + * @return void + */ + public function testRedirectWithMissingPassword() + { + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'http://vimeo.com/68375962']), + $this->response + ); + $this->assertTrue($result->isRedirect()); + } + + /** + * Test the redirect() function with an error + * @return void + */ + public function testRedirectWithError() + { + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'http://example.com/foo']), + $this->response + ); + $this->assertTrue($result->isServerError()); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..3913383 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,11 @@ + Date: Mon, 16 Jan 2017 16:31:20 +0000 Subject: [PATCH 35/65] Apply fixes from StyleCI --- controllers/FrontController.php | 35 +++++++++++------- tests/FrontControllerTest.php | 63 +++++++++++++++++++++------------ tests/bootstrap.php | 4 +-- 3 files changed, 65 insertions(+), 37 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 2126211..98b753b 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -98,6 +98,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -123,6 +124,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -146,15 +148,18 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** - * Return the converted MP3 file - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * @param array $params GET query parameters - * @param string $password Video password + * Return the converted MP3 file. + * + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * * @return Response */ private function getAudioResponse(Request $request, Response $response, array $params, $password = null) @@ -187,11 +192,13 @@ class FrontController } /** - * Return the video description page - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * @param array $params GET query parameters - * @param string $password Video password + * Return the video description page. + * + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * * @return Response */ private function getVideoResponse(Request $request, Response $response, array $params, $password = null) @@ -219,6 +226,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -354,10 +362,11 @@ class FrontController } } - /** - * Generate the canonical URL of the current page - * @param Request $request PSR-7 Request + * Generate the canonical URL of the current page. + * + * @param Request $request PSR-7 Request + * * @return string URL */ private function getCanonicalUrl(Request $request) diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index f04d9d5..ace68ea 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -5,8 +5,8 @@ namespace Alltube\Test; -use Alltube\Controller\FrontController; use Alltube\Config; +use Alltube\Controller\FrontController; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -56,7 +56,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the constructor with streams enabled + * Test the constructor with streams enabled. + * * @return void */ public function testConstructorWithStream() @@ -68,7 +69,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the index() function + * Test the index() function. + * * @return void */ public function testIndex() @@ -78,7 +80,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the index() function with a custom URI + * Test the index() function with a custom URI. + * * @return void */ public function testIndexWithCustomUri() @@ -93,7 +96,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the extractors() function + * Test the extractors() function. + * * @return void */ public function testExtractors() @@ -103,7 +107,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the password() function + * Test the password() function. + * * @return void */ public function testPassword() @@ -113,7 +118,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function without the url parameter + * Test the video() function without the url parameter. + * * @return void */ public function testVideoWithoutUrl() @@ -123,7 +129,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function + * Test the video() function. + * * @return void */ public function testVideo() @@ -136,7 +143,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with audio conversion + * Test the video() function with audio conversion. + * * @return void */ public function testVideoWithAudio() @@ -149,15 +157,16 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with audio enabled and an URL that doesn't need to be converted + * Test the video() function with audio enabled and an URL that doesn't need to be converted. + * * @return void */ public function testVideoWithUnconvertedAudio() { $result = $this->controller->video( $this->request->withQueryParams( - ['url'=>'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', - 'audio'=>true] + ['url' => 'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', + 'audio'=> true, ] ), $this->response ); @@ -165,7 +174,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with a password + * Test the video() function with a password. + * * @return void */ public function testVideoWithPassword() @@ -179,7 +189,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with a missing password + * Test the video() function with a missing password. + * * @return void */ public function testVideoWithMissingPassword() @@ -197,7 +208,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with streams enabled + * Test the video() function with streams enabled. + * * @return void */ public function testVideoWithStream() @@ -217,7 +229,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the error() function + * Test the error() function. + * * @return void */ public function testError() @@ -227,7 +240,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function without the URL parameter + * Test the redirect() function without the URL parameter. + * * @return void */ public function testRedirectWithoutUrl() @@ -237,7 +251,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function + * Test the redirect() function. + * * @return void */ public function testRedirect() @@ -250,7 +265,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with streams enabled + * Test the redirect() function with streams enabled. + * * @return void */ public function testRedirectWithStream() @@ -265,7 +281,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with an M3U stream + * Test the redirect() function with an M3U stream. + * * @return void */ public function testRedirectWithM3uStream() @@ -280,7 +297,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with a missing password + * Test the redirect() function with a missing password. + * * @return void */ public function testRedirectWithMissingPassword() @@ -293,7 +311,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with an error + * Test the redirect() function with an error. + * * @return void */ public function testRedirectWithError() diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3913383..074ec50 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,10 +1,10 @@ Date: Mon, 16 Jan 2017 17:47:26 +0100 Subject: [PATCH 36/65] Fix docblocks --- controllers/FrontController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 98b753b..67b8c04 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -81,7 +81,7 @@ class FrontController * @param Request $request PSR-7 request * @param Response $response PSR-7 response * - * @return void + * @return Response HTTP response */ public function index(Request $request, Response $response) { @@ -108,7 +108,7 @@ class FrontController * @param Request $request PSR-7 request * @param Response $response PSR-7 response * - * @return void + * @return Response HTTP response */ public function extractors(Request $request, Response $response) { @@ -160,7 +160,7 @@ class FrontController * @param array $params GET query parameters * @param string $password Video password * - * @return Response + * @return Response HTTP response */ private function getAudioResponse(Request $request, Response $response, array $params, $password = null) { @@ -199,7 +199,7 @@ class FrontController * @param array $params GET query parameters * @param string $password Video password * - * @return Response + * @return Response HTTP response */ private function getVideoResponse(Request $request, Response $response, array $params, $password = null) { @@ -290,7 +290,7 @@ class FrontController * @param Request $request PSR-7 request * @param string $password Video password * - * @return Response + * @return Response HTTP response */ private function getStream($url, $format, $response, $request, $password = null) { From c99cc09c31e62ac052e4b6489e1ac378730fdffc Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 17:48:32 +0100 Subject: [PATCH 37/65] Missing property --- controllers/FrontController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 67b8c04..24f7440 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -54,6 +54,12 @@ class FrontController */ private $view; + /** + * Default youtube-dl format + * @var string + */ + private $defaultFormat = 'best[protocol^=http]'; + /** * FrontController constructor. * @@ -70,8 +76,6 @@ class FrontController $this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController'); if ($this->config->stream) { $this->defaultFormat = 'best'; - } else { - $this->defaultFormat = 'best[protocol^=http]'; } } From 77eaec87ab60a7bf7c664d2e1cdc226b3f3e2597 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 17:50:58 +0100 Subject: [PATCH 38/65] Lint --- controllers/FrontController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 24f7440..233be8c 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -55,7 +55,8 @@ class FrontController private $view; /** - * Default youtube-dl format + * Default youtube-dl format. + * * @var string */ private $defaultFormat = 'best[protocol^=http]'; From 7cab8f69c335dc58d6a35965a4aba32e20445b36 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 18:45:33 +0100 Subject: [PATCH 39/65] Remove obsolete parameters --- tests/VideoDownloadTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 3744305..bcdd92b 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -282,8 +282,6 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase * @param string $url URL * @param string $format Format * @param string $filename Filename - * @param string $domain Domain - * @param string $audioFilename MP3 audio file name * * @return void * @dataProvider urlProvider From d62f69fb7c9cf561fc6a6b6f62b863f59826dd88 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 18:47:49 +0100 Subject: [PATCH 40/65] Missing properties --- tests/FrontControllerTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index ace68ea..20d74b3 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -17,6 +17,30 @@ use Slim\Http\Response; */ class FrontControllerTest extends \PHPUnit_Framework_TestCase { + /** + * Slim dependency container + * @var Container + */ + private $container; + + /** + * Mock HTTP request + * @var Request + */ + private $request; + + /** + * Mock HTTP response + * @var Response + */ + private $response; + + /** + * FrontController instance used in tests + * @var FrontController + */ + private $controller; + /** * Prepare tests. */ From 985364c047e15ef3be14a854edf113f7a9d79027 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 18:51:42 +0100 Subject: [PATCH 41/65] Unused variable --- tests/VideoDownloadTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index bcdd92b..2003395 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -241,7 +241,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase */ public function testGetJSONError($url) { - $videoURL = $this->download->getJSON($url); + $this->download->getJSON($url); } /** From cb01839e6e094a904f47d6a3221d10ec61a5079f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 18:54:03 +0100 Subject: [PATCH 42/65] Lint --- tests/FrontControllerTest.php | 12 ++++++++---- tests/VideoDownloadTest.php | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index 20d74b3..c3b946e 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -18,25 +18,29 @@ use Slim\Http\Response; class FrontControllerTest extends \PHPUnit_Framework_TestCase { /** - * Slim dependency container + * Slim dependency container. + * * @var Container */ private $container; /** - * Mock HTTP request + * Mock HTTP request. + * * @var Request */ private $request; /** - * Mock HTTP response + * Mock HTTP response. + * * @var Response */ private $response; /** - * FrontController instance used in tests + * FrontController instance used in tests. + * * @var FrontController */ private $controller; diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 2003395..39119db 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -279,9 +279,9 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase /** * Test getAudioFilename function. * - * @param string $url URL - * @param string $format Format - * @param string $filename Filename + * @param string $url URL + * @param string $format Format + * @param string $filename Filename * * @return void * @dataProvider urlProvider From 181d57801926334f7b810794db6098df73c50eea Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 23:47:07 +0100 Subject: [PATCH 43/65] youtube-dl update (fixes #91) --- composer.json | 6 +++--- composer.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 40034db..b922462 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.7.2", "ffmpeg/ffmpeg": "dev-release", - "rg3/youtube-dl": "~2017.01.14", + "rg3/youtube-dl": "~2017.01.16", "rudloff/rtmpdump-bin": "~2.3", "heroku/heroku-buildpack-php": "*" }, @@ -37,10 +37,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.01.14", + "version": "2017.01.16", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.14.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.16.zip" } } }, diff --git a/composer.lock b/composer.lock index 7bda9cb..bf26b01 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "44b24b403652e1a7e450280e4643e37e", + "content-hash": "5509068a3b20c3179625873a9a911e28", "packages": [ { "name": "aura/session", @@ -1665,10 +1665,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.01.14", + "version": "2017.01.16", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.14.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.16.zip", "reference": null, "shasum": null }, From e7dac692c60f5ea0c2f4043c66f431a9dd5e4b15 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 19 Jan 2017 22:10:44 +0100 Subject: [PATCH 44/65] Add heroku local instructions to FAQ (fixes #86) --- FAQ.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FAQ.md b/FAQ.md index 5600add..79b1d30 100644 --- a/FAQ.md +++ b/FAQ.md @@ -102,3 +102,24 @@ Alltube can rename videos automatically if you enable streaming (see above). ## I want to download a video that isn't available in my country If the video is available in the server's country, you can download it if you enable streaming (see above). + +## How do I run Heroku locally? + +You should be able to `heroku local` like this: + +```bash +sudo APACHE_LOCK_DIR=. APACHE_PID_FILE=./pid APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data APACHE_LOG_DIR=. heroku local +``` + +You might need to create some symlinks before that: + +```bash +ln -s /usr/sbin/apache2 /usr/sbin/httpd +ln -s /usr/sbin/php-fpm7.0 /usr/sbin/php-fpm +``` + +And you probably need to run this in another terminal after `heroku local` has finished launching `php-fpm`: + +```bash +chmod 0667 /tmp/heroku.fcgi.5000.sock +``` From f5b1b9227cd3bfbbfc95f0211ad3ddb9a433b6ba Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 19 Jan 2017 22:29:34 +0100 Subject: [PATCH 45/65] Fix outdated info in FAQ --- FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 79b1d30..3677ce8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -61,7 +61,7 @@ Some websites generate an unique video URL for each IP address. When using Alltu There are two known workarounds: * You can run Alltube locally on your computer. -* You can use the experimental `feature/stream` branch which streams the video through the server in order to bypass IP restrictions. +* You can enable streaming videos through the server (see below). Please note that this can use a lot of resources on the server (which is why we won't enable it on alltubedownload.net). ## CSS and JavaScript files are missing From fda8ea8dddbf57a76ae6811cb3ff21cd21bf1c05 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 30 Jan 2017 17:09:49 +0100 Subject: [PATCH 46/65] Dependencies update --- composer.lock | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/composer.lock b/composer.lock index bf26b01..55211e0 100644 --- a/composer.lock +++ b/composer.lock @@ -985,16 +985,16 @@ }, { "name": "heroku/heroku-buildpack-php", - "version": "v117", + "version": "v119", "source": { "type": "git", "url": "https://github.com/heroku/heroku-buildpack-php.git", - "reference": "960199a978308c75926fd9bb4775f7113bf1d777" + "reference": "26ebb69005d467d45f75797c1594f60818ba3fce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/960199a978308c75926fd9bb4775f7113bf1d777", - "reference": "960199a978308c75926fd9bb4775f7113bf1d777", + "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/26ebb69005d467d45f75797c1594f60818ba3fce", + "reference": "26ebb69005d467d45f75797c1594f60818ba3fce", "shasum": "" }, "bin": [ @@ -1025,20 +1025,20 @@ "nginx", "php" ], - "time": "2016-12-09T19:37:38+00:00" + "time": "2017-01-21T00:39:13+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.5.5", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108" + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "shasum": "" }, "require": { @@ -1067,7 +1067,7 @@ "object", "object graph" ], - "time": "2016-10-31T17:19:45+00:00" + "time": "2017-01-26T22:05:40+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1280,16 +1280,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a" + "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c14196e64a78570034afd0b7a9f3757ba71c2a0a", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", + "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", "shasum": "" }, "require": { @@ -1339,7 +1339,7 @@ "testing", "xunit" ], - "time": "2016-12-20T15:22:42+00:00" + "time": "2017-01-20T15:06:43+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1524,16 +1524,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.7.5", + "version": "5.7.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "50fd2be8f3e23e91da825f36f08e5f9633076ffe" + "reference": "69f832b87c731d5cacad7f91948778fe98335fdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50fd2be8f3e23e91da825f36f08e5f9633076ffe", - "reference": "50fd2be8f3e23e91da825f36f08e5f9633076ffe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/69f832b87c731d5cacad7f91948778fe98335fdd", + "reference": "69f832b87c731d5cacad7f91948778fe98335fdd", "shasum": "" }, "require": { @@ -1545,7 +1545,7 @@ "myclabs/deep-copy": "~1.3", "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.3", + "phpunit/php-code-coverage": "^4.0.4", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", @@ -1602,7 +1602,7 @@ "testing", "xunit" ], - "time": "2016-12-28T07:18:51+00:00" + "time": "2017-01-28T06:14:33+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1721,16 +1721,16 @@ }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { @@ -1781,7 +1781,7 @@ "compare", "equality" ], - "time": "2016-11-19T09:18:40+00:00" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", From 83544437b611516ece603fda2be85d89fe110651 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 30 Jan 2017 17:19:18 +0100 Subject: [PATCH 47/65] Use local phpunit on Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dfeb0ad..2281c97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ install: - composer install before_install: - npm install -g npm@3 +script: vendor/bin/phpunit after_success: - bash <(curl -s https://codecov.io/bash) before_deploy: From 4aca4b138e87e6ae1e53abc243d08fec9c9b2c0c Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 31 Jan 2017 01:51:26 +0100 Subject: [PATCH 48/65] youtube-dl update --- composer.json | 6 +++--- composer.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index b922462..7f3d80c 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.7.2", "ffmpeg/ffmpeg": "dev-release", - "rg3/youtube-dl": "~2017.01.16", + "rg3/youtube-dl": "~2017.01.29", "rudloff/rtmpdump-bin": "~2.3", "heroku/heroku-buildpack-php": "*" }, @@ -37,10 +37,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.01.16", + "version": "2017.01.29", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.16.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.29.zip" } } }, diff --git a/composer.lock b/composer.lock index 55211e0..27d2451 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "5509068a3b20c3179625873a9a911e28", + "content-hash": "ce686845bcfdf7a8df1d2741140c1375", "packages": [ { "name": "aura/session", @@ -1665,10 +1665,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.01.16", + "version": "2017.01.29", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.16.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2017.01.29.zip", "reference": null, "shasum": null }, From 6bdab67854167d04b4be16e894d2ea1d50d6489a Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 25 Feb 2017 15:22:52 +0100 Subject: [PATCH 49/65] Dependencies update --- composer.lock | 182 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 121 insertions(+), 61 deletions(-) diff --git a/composer.lock b/composer.lock index 27d2451..7883e3a 100644 --- a/composer.lock +++ b/composer.lock @@ -70,18 +70,21 @@ }, { "name": "container-interop/container-interop", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/container-interop/container-interop.git", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", - "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", "shasum": "" }, + "require": { + "psr/container": "^1.0" + }, "type": "library", "autoload": { "psr-4": { @@ -93,7 +96,8 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30T15:22:37+00:00" + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" }, { "name": "guzzlehttp/guzzle", @@ -210,16 +214,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", + "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", "shasum": "" }, "require": { @@ -255,16 +259,23 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-06-24T23:00:38+00:00" + "time": "2017-02-21T01:20:32+00:00" }, { "name": "jeremykendall/php-domain-parser", @@ -444,16 +455,16 @@ }, { "name": "nikic/fast-route", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/nikic/FastRoute.git", - "reference": "f3dcf5130e634b6123d40727d612ec6aa4f61fb3" + "reference": "b5f95749071c82a8e0f58586987627054400cdf6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/f3dcf5130e634b6123d40727d612ec6aa4f61fb3", - "reference": "f3dcf5130e634b6123d40727d612ec6aa4f61fb3", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6", "shasum": "" }, "require": { @@ -483,7 +494,7 @@ "router", "routing" ], - "time": "2016-10-20T17:36:47+00:00" + "time": "2017-01-19T11:35:12+00:00" }, { "name": "pimple/pimple", @@ -531,6 +542,55 @@ ], "time": "2015-09-11T15:10:35+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -811,16 +871,16 @@ }, { "name": "symfony/process", - "version": "v3.2.2", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893" + "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/350e810019fc52dd06ae844b6a6d382f8a0e8893", - "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893", + "url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", + "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", "shasum": "" }, "require": { @@ -856,20 +916,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:32:22+00:00" + "time": "2017-02-16T14:07:22+00:00" }, { "name": "symfony/yaml", - "version": "v3.2.2", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "50eadbd7926e31842893c957eca362b21592a97d" + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/50eadbd7926e31842893c957eca362b21592a97d", - "reference": "50eadbd7926e31842893c957eca362b21592a97d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "shasum": "" }, "require": { @@ -911,7 +971,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-03T13:51:32+00:00" + "time": "2017-02-16T22:46:52+00:00" } ], "packages-dev": [ @@ -985,16 +1045,16 @@ }, { "name": "heroku/heroku-buildpack-php", - "version": "v119", + "version": "v120", "source": { "type": "git", "url": "https://github.com/heroku/heroku-buildpack-php.git", - "reference": "26ebb69005d467d45f75797c1594f60818ba3fce" + "reference": "e0499a7fdffd56f46534a037a6c48d65cef4e645" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/26ebb69005d467d45f75797c1594f60818ba3fce", - "reference": "26ebb69005d467d45f75797c1594f60818ba3fce", + "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/e0499a7fdffd56f46534a037a6c48d65cef4e645", + "reference": "e0499a7fdffd56f46534a037a6c48d65cef4e645", "shasum": "" }, "bin": [ @@ -1025,7 +1085,7 @@ "nginx", "php" ], - "time": "2017-01-21T00:39:13+00:00" + "time": "2017-02-20T15:05:49+00:00" }, { "name": "myclabs/deep-copy", @@ -1280,23 +1340,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971" + "reference": "ca060f645beeddebedb1885c97bf163e93264c35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", - "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca060f645beeddebedb1885c97bf163e93264c35", + "reference": "ca060f645beeddebedb1885c97bf163e93264c35", "shasum": "" }, "require": { "php": "^5.6 || ^7.0", "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", "sebastian/code-unit-reverse-lookup": "~1.0", "sebastian/environment": "^1.3.2 || ^2.0", "sebastian/version": "~1.0|~2.0" @@ -1339,7 +1399,7 @@ "testing", "xunit" ], - "time": "2017-01-20T15:06:43+00:00" + "time": "2017-02-23T07:38:02+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1475,16 +1535,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.9", + "version": "1.4.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/284fb0679dd25fb5ffb56dad92c72860c0a22f1b", + "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b", "shasum": "" }, "require": { @@ -1520,20 +1580,20 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15T14:06:22+00:00" + "time": "2017-02-23T06:14:45+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.9", + "version": "5.7.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "69f832b87c731d5cacad7f91948778fe98335fdd" + "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/69f832b87c731d5cacad7f91948778fe98335fdd", - "reference": "69f832b87c731d5cacad7f91948778fe98335fdd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4906b8faf23e42612182fd212eb6f4c0f2954b57", + "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57", "shasum": "" }, "require": { @@ -1550,14 +1610,14 @@ "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.2.2", + "sebastian/comparator": "^1.2.4", "sebastian/diff": "~1.2", "sebastian/environment": "^1.3.4 || ^2.0", "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.0 || ^2.0", + "sebastian/global-state": "^1.1", "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", + "sebastian/version": "~1.0.3|~2.0", "symfony/yaml": "~2.1|~3.0" }, "conflict": { @@ -1602,7 +1662,7 @@ "testing", "xunit" ], - "time": "2017-01-28T06:14:33+00:00" + "time": "2017-02-19T07:22:16+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2005,16 +2065,16 @@ }, { "name": "sebastian/object-enumerator", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", "shasum": "" }, "require": { @@ -2047,7 +2107,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19T07:35:10+00:00" + "time": "2017-02-18T15:18:39+00:00" }, { "name": "sebastian/recursion-context", @@ -2326,16 +2386,16 @@ }, { "name": "symfony/var-dumper", - "version": "v3.2.2", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2" + "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b54b23f9a19b465e76fdaac0f6732410467c83b2", - "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb50260b674ee1c2d4ab49f2395a42e0b4681e20", + "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20", "shasum": "" }, "require": { @@ -2385,7 +2445,7 @@ "debug", "dump" ], - "time": "2017-01-03T08:53:57+00:00" + "time": "2017-02-16T22:46:52+00:00" }, { "name": "webmozart/assert", From 1558f53a120600e04a284925117736630479ca7e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 25 Feb 2017 15:23:32 +0100 Subject: [PATCH 50/65] youtube-dl update --- composer.json | 6 +++--- composer.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 7f3d80c..ec1a1ec 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.7.2", "ffmpeg/ffmpeg": "dev-release", - "rg3/youtube-dl": "~2017.01.29", + "rg3/youtube-dl": "~2017.02.24.1", "rudloff/rtmpdump-bin": "~2.3", "heroku/heroku-buildpack-php": "*" }, @@ -37,10 +37,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.01.29", + "version": "2017.02.24.1", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.29.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2017.02.24.1.zip" } } }, diff --git a/composer.lock b/composer.lock index 7883e3a..73c4e90 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ce686845bcfdf7a8df1d2741140c1375", + "content-hash": "6830d80c4401c4b84508cef5e975f030", "packages": [ { "name": "aura/session", @@ -1725,10 +1725,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.01.29", + "version": "2017.02.24.1", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.01.29.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2017.02.24.1.zip", "reference": null, "shasum": null }, From ec1124692fa1e1e78619a1bd2a5a0b9c026122e8 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 2 Mar 2017 22:58:37 +0100 Subject: [PATCH 51/65] Add update instructions to README (fixes #95) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index f35d40b..5a3c08f 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,16 @@ chmod 777 templates_c/ If your web server is Apache, you need to set the `AllowOverride` setting to `All` or `FileInfo`. +#### Update + +When updating from Git, you need to run npm and Composer again: + +```bash +git pull +npm install +composer install +``` + ## Config If you want to use a custom config, you need to create a config file: From 15cea297d85efe5906f0f0d45bf6cfedd0b4475f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 2 Mar 2017 23:05:25 +0100 Subject: [PATCH 52/65] Dependencies update --- composer.lock | 105 ++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/composer.lock b/composer.lock index 73c4e90..262509b 100644 --- a/composer.lock +++ b/composer.lock @@ -101,21 +101,21 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "6.2.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", "shasum": "" }, "require": { "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", + "guzzlehttp/psr7": "^1.4", "php": ">=5.5" }, "require-dev": { @@ -159,7 +159,7 @@ "rest", "web service" ], - "time": "2016-10-08T15:01:37+00:00" + "time": "2017-02-28T22:50:30+00:00" }, { "name": "guzzlehttp/promises", @@ -214,16 +214,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569" + "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", - "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855", + "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855", "shasum": "" }, "require": { @@ -275,7 +275,7 @@ "uri", "url" ], - "time": "2017-02-21T01:20:32+00:00" + "time": "2017-02-27T10:51:17+00:00" }, { "name": "jeremykendall/php-domain-parser", @@ -1277,27 +1277,27 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", + "phpspec/phpspec": "^2.5|^3.2", "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", @@ -1336,39 +1336,39 @@ "spy", "stub" ], - "time": "2016-11-21T14:58:47+00:00" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.6", + "version": "4.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca060f645beeddebedb1885c97bf163e93264c35" + "reference": "09e2277d14ea467e5a984010f501343ef29ffc69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca060f645beeddebedb1885c97bf163e93264c35", - "reference": "ca060f645beeddebedb1885c97bf163e93264c35", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09e2277d14ea467e5a984010f501343ef29ffc69", + "reference": "09e2277d14ea467e5a984010f501343ef29ffc69", "shasum": "" }, "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "~1.0", + "sebastian/code-unit-reverse-lookup": "^1.0", "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { @@ -1399,7 +1399,7 @@ "testing", "xunit" ], - "time": "2017-02-23T07:38:02+00:00" + "time": "2017-03-01T09:12:17+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1491,25 +1491,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1531,20 +1536,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.10", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/284fb0679dd25fb5ffb56dad92c72860c0a22f1b", - "reference": "284fb0679dd25fb5ffb56dad92c72860c0a22f1b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -1580,20 +1585,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-23T06:14:45+00:00" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.14", + "version": "5.7.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57" + "reference": "b99112aecc01f62acf3d81a3f59646700a1849e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4906b8faf23e42612182fd212eb6f4c0f2954b57", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b99112aecc01f62acf3d81a3f59646700a1849e5", + "reference": "b99112aecc01f62acf3d81a3f59646700a1849e5", "shasum": "" }, "require": { @@ -1662,7 +1667,7 @@ "testing", "xunit" ], - "time": "2017-02-19T07:22:16+00:00" + "time": "2017-03-02T15:22:43+00:00" }, { "name": "phpunit/phpunit-mock-objects", From c9341acfb9b8d153587a79f393a2beddad743fb6 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 2 Mar 2017 23:10:02 +0100 Subject: [PATCH 53/65] Download ffmpeg over HTTPS --- composer.json | 5 +---- composer.lock | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index ec1a1ec..01a1b8c 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "name": "ffmpeg/ffmpeg", "version": "dev-release", "dist": { - "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", + "url": "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", "type": "xz" }, "bin": [ @@ -79,9 +79,6 @@ "Alltube\\Controller\\": "controllers/" } }, - "config": { - "secure-http": false - }, "scripts": { "compile": "composer install --dev" } diff --git a/composer.lock b/composer.lock index 262509b..1fb8578 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "6830d80c4401c4b84508cef5e975f030", + "content-hash": "5ff95adf3751e6b743e5467142b41ce7", "packages": [ { "name": "aura/session", @@ -1034,7 +1034,7 @@ "version": "dev-release", "dist": { "type": "xz", - "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", + "url": "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", "reference": null, "shasum": null }, From 2eb9b642e7529952b5f16b5c9a9e80d6e692030c Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 8 Mar 2017 10:25:28 +0100 Subject: [PATCH 54/65] youtube-dl update --- composer.json | 6 +++--- composer.lock | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 01a1b8c..fb072d0 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "squizlabs/php_codesniffer": "~2.7.0", "phpunit/phpunit": "~5.7.2", "ffmpeg/ffmpeg": "dev-release", - "rg3/youtube-dl": "~2017.02.24.1", + "rg3/youtube-dl": "~2017.03.07", "rudloff/rtmpdump-bin": "~2.3", "heroku/heroku-buildpack-php": "*" }, @@ -37,10 +37,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.02.24.1", + "version": "2017.03.07", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.02.24.1.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2017.03.07.zip" } } }, diff --git a/composer.lock b/composer.lock index 1fb8578..8864bd9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "5ff95adf3751e6b743e5467142b41ce7", + "content-hash": "1ac742cf7c2832a7af628c157ced2dbc", "packages": [ { "name": "aura/session", @@ -1730,10 +1730,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.02.24.1", + "version": "2017.03.07", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.02.24.1.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2017.03.07.zip", "reference": null, "shasum": null }, @@ -1741,23 +1741,23 @@ }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1782,7 +1782,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13T06:45:14+00:00" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", From 956645691f9800de68c8d47bfe568da3c41d52bf Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 12 Mar 2017 12:26:33 +0100 Subject: [PATCH 55/65] Typo in FAQ --- FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 3677ce8..3fdd5fa 100644 --- a/FAQ.md +++ b/FAQ.md @@ -105,7 +105,7 @@ If the video is available in the server's country, you can download it if you en ## How do I run Heroku locally? -You should be able to `heroku local` like this: +You should be able to use `heroku local` like this: ```bash sudo APACHE_LOCK_DIR=. APACHE_PID_FILE=./pid APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data APACHE_LOG_DIR=. heroku local From f9070e80c2a8a957c6c222892e26617ace6d0cf2 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 12 Mar 2017 23:44:56 +0100 Subject: [PATCH 56/65] Grunt plugins update --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fbb66ee..aac35c1 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,11 @@ "dependencies": { "bower": "~1.8.0", "grunt": "~1.0.1", - "grunt-contrib-cssmin": "~1.0.0", - "grunt-contrib-uglify": "~2.0.0" + "grunt-contrib-cssmin": "~2.0.0", + "grunt-contrib-uglify": "~2.2.0" }, "devDependencies": { - "grunt-contrib-compress": "~1.3.0", + "grunt-contrib-compress": "~1.4.1", "grunt-contrib-watch": "~1.0.0", "grunt-fixpack": "~0.1.0", "grunt-githash": "~0.1.3", From 35e1dd0da49ddf672a5172bbf336191d82368bc1 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 14 Mar 2017 01:40:19 +0100 Subject: [PATCH 57/65] Symfony update --- composer.lock | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/composer.lock b/composer.lock index 8864bd9..baf724b 100644 --- a/composer.lock +++ b/composer.lock @@ -871,16 +871,16 @@ }, { "name": "symfony/process", - "version": "v3.2.4", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856" + "reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", - "reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856", + "url": "https://api.github.com/repos/symfony/process/zipball/68bfa8c83f24c0ac04ea7193bcdcda4519f41892", + "reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892", "shasum": "" }, "require": { @@ -916,20 +916,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-02-16T14:07:22+00:00" + "time": "2017-03-04T12:23:14+00:00" }, { "name": "symfony/yaml", - "version": "v3.2.4", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" + "reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", - "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", + "url": "https://api.github.com/repos/symfony/yaml/zipball/093e416ad096355149e265ea2e4cc1f9ee40ab1a", + "reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a", "shasum": "" }, "require": { @@ -971,7 +971,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-02-16T22:46:52+00:00" + "time": "2017-03-07T16:47:02+00:00" } ], "packages-dev": [ @@ -1034,7 +1034,7 @@ "version": "dev-release", "dist": { "type": "xz", - "url": "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", + "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", "reference": null, "shasum": null }, @@ -2391,22 +2391,25 @@ }, { "name": "symfony/var-dumper", - "version": "v3.2.4", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20" + "reference": "4100f347aff890bc16b0b4b42843b599db257b2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb50260b674ee1c2d4ab49f2395a42e0b4681e20", - "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/4100f347aff890bc16b0b4b42843b599db257b2d", + "reference": "4100f347aff890bc16b0b4b42843b599db257b2d", "shasum": "" }, "require": { "php": ">=5.5.9", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, "require-dev": { "twig/twig": "~1.20|~2.0" }, @@ -2450,7 +2453,7 @@ "debug", "dump" ], - "time": "2017-02-16T22:46:52+00:00" + "time": "2017-02-20T13:45:48+00:00" }, { "name": "webmozart/assert", From 9d4569244f64d7864518f9f0700ed8adcca3c315 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 14 Mar 2017 11:29:06 +0100 Subject: [PATCH 58/65] Fix FFMPEG URL in composer.lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index baf724b..d3b7f66 100644 --- a/composer.lock +++ b/composer.lock @@ -1034,7 +1034,7 @@ "version": "dev-release", "dist": { "type": "xz", - "url": "http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", + "url": "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz", "reference": null, "shasum": null }, From 7f34e3b2ec36aa3bd544ca790fe3560014502d37 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 18 Mar 2017 00:02:38 +0100 Subject: [PATCH 59/65] phpunit update --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index d3b7f66..8edfbe1 100644 --- a/composer.lock +++ b/composer.lock @@ -1589,16 +1589,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.7.15", + "version": "5.7.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b99112aecc01f62acf3d81a3f59646700a1849e5" + "reference": "dafc78e2a7d12139b0e97078d1082326bd09363d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b99112aecc01f62acf3d81a3f59646700a1849e5", - "reference": "b99112aecc01f62acf3d81a3f59646700a1849e5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/dafc78e2a7d12139b0e97078d1082326bd09363d", + "reference": "dafc78e2a7d12139b0e97078d1082326bd09363d", "shasum": "" }, "require": { @@ -1667,7 +1667,7 @@ "testing", "xunit" ], - "time": "2017-03-02T15:22:43+00:00" + "time": "2017-03-15T13:02:34+00:00" }, { "name": "phpunit/phpunit-mock-objects", From 2ebea7749b7240bbe6e3b1f3f50a45f9a5005e90 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 19 Mar 2017 12:27:08 +0100 Subject: [PATCH 60/65] Fix redirect when no format is specified --- controllers/FrontController.php | 12 +++++++----- tests/FrontControllerTest.php | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 233be8c..84ef036 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -299,9 +299,6 @@ class FrontController */ private function getStream($url, $format, $response, $request, $password = null) { - if (!isset($format)) { - $format = 'best'; - } $video = $this->download->getJSON($url, $format, $password); if ($video->protocol == 'm3u8') { $stream = $this->download->getM3uStream($video); @@ -334,12 +331,17 @@ class FrontController public function redirect(Request $request, Response $response) { $params = $request->getQueryParams(); + if (isset($params['format'])) { + $format = $params['format']; + } else { + $format = $this->defaultFormat; + } if (isset($params['url'])) { try { if ($this->config->stream) { return $this->getStream( $params['url'], - $request->getParam('format'), + $format, $response, $request, $this->sessionSegment->getFlash($params['url']) @@ -347,7 +349,7 @@ class FrontController } else { $url = $this->download->getURL( $params['url'], - $request->getParam('format'), + $format, $this->sessionSegment->getFlash($params['url']) ); diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index c3b946e..efbed07 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -292,6 +292,19 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($result->isRedirect()); } + /** + * Test the redirect() function with a specific format. + * @return void + */ + public function testRedirectWithFormat() + { + $result = $this->controller->redirect( + $this->request->withQueryParams(['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format'=>'worst']), + $this->response + ); + $this->assertTrue($result->isRedirect()); + } + /** * Test the redirect() function with streams enabled. * @@ -317,7 +330,9 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase { $config = Config::getInstance(); $config->stream = true; - $result = $this->controller->redirect( + //We need to create a new controller instance in order to apply the custom config + $controller = new FrontController($this->container); + $result = $controller->redirect( $this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']), $this->response ); From 4958f59a6768c73989dbfa9be36b9e3010a03ef8 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 19 Mar 2017 12:28:54 +0100 Subject: [PATCH 61/65] Lint --- tests/FrontControllerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index efbed07..7152a24 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -294,6 +294,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase /** * Test the redirect() function with a specific format. + * * @return void */ public function testRedirectWithFormat() From 30cd469c587bd4c3688425c02eda7b88fd071f12 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 29 Mar 2017 21:30:02 +0200 Subject: [PATCH 62/65] Add Docker instructions to FAQ --- FAQ.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FAQ.md b/FAQ.md index 3fdd5fa..c03462e 100644 --- a/FAQ.md +++ b/FAQ.md @@ -103,6 +103,12 @@ Alltube can rename videos automatically if you enable streaming (see above). If the video is available in the server's country, you can download it if you enable streaming (see above). +## How do I run the Docker image? + +```bash +docker run -p 8080:80 rudloff/alltube +``` + ## How do I run Heroku locally? You should be able to use `heroku local` like this: From 23906c7e8464c0ebc3c0346c79c3339cc7104569 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 29 Mar 2017 21:42:48 +0200 Subject: [PATCH 63/65] Use locally installed grunt and bower in Docker image --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92426ba..7486ca9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,11 @@ RUN apt-get install -y libicu-dev xz-utils git zlib1g-dev python nodejs RUN docker-php-ext-install mbstring RUN docker-php-ext-install intl RUN docker-php-ext-install zip -RUN npm install -g bower grunt-cli RUN a2enmod rewrite RUN curl -sS https://getcomposer.org/installer | php COPY php.ini /usr/local/etc/php/ COPY . /var/www/html/ RUN php composer.phar install --prefer-dist RUN npm install -RUN bower --allow-root install -RUN grunt +RUN ./node_modules/.bin/bower --allow-root install +RUN ./node_modules/.bin/grunt From 9336b7dc53943890fe2053ac9d0a664d717a10de Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 29 Mar 2017 23:30:15 +0200 Subject: [PATCH 64/65] Enable conversion on Docker image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 7486ca9..211291d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,3 +13,4 @@ RUN php composer.phar install --prefer-dist RUN npm install RUN ./node_modules/.bin/bower --allow-root install RUN ./node_modules/.bin/grunt +ENV CONVERT=1 From f33ea5ec2e63573fe9e82f644c1d737d2f44b0f3 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 2 Apr 2017 20:37:50 +0200 Subject: [PATCH 65/65] 0.7.2-beta2 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aac35c1..69ce6d1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "alltube", "description": "HTML GUI for youtube-dl", - "version": "0.7.2-beta", + "version": "0.7.2-beta2", "author": "Pierre Rudloff", "bugs": "https://github.com/Rudloff/alltube/issues", "dependencies": {