diff --git a/classes/Config.php b/classes/Config.php index b68a2c7..daa4253 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -68,6 +68,12 @@ class Config */ public $avconv = 'vendor/bin/ffmpeg'; + /** + * Path to the directory that contains the phantomjs binary. + * @var string + */ + public $phantomjsDir = 'vendor/bin/'; + /** * Disable URL rewriting. * diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 5ac5878..398a6f0 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -99,7 +99,7 @@ class VideoDownload $process = $this->getProcess($arguments); //This is needed by the openload extractor because it runs PhantomJS - $process->setEnv(['QT_QPA_PLATFORM'=>'offscreen']); + $process->setEnv(['QT_QPA_PLATFORM'=>'phantom', 'PATH'=>$this->config->phantomjsDir]); $process->inheritEnvironmentVariables(); $process->run(); if (!$process->isSuccessful()) { diff --git a/composer.json b/composer.json index e773526..fe25f0b 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,10 @@ "squizlabs/php_codesniffer": "~3.2.2", "phpunit/phpunit": "~6.5.2", "doctrine/instantiator": "~1.0.0", - "ffmpeg/ffmpeg": "3.4.1", - "rg3/youtube-dl": "2017.12.10", - "heroku/heroku-buildpack-php": "*" + "ffmpeg/ffmpeg": "~3.4.1", + "rg3/youtube-dl": "2018.01.21", + "heroku/heroku-buildpack-php": "*", + "anam/phantomjs-linux-x86-binary": "~2.1.1" }, "extra": { "paas": { @@ -38,10 +39,10 @@ "type": "package", "package": { "name": "rg3/youtube-dl", - "version": "2017.12.10", + "version": "2018.01.21", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.12.10.zip" + "url": "https://github.com/rg3/youtube-dl/archive/2018.01.21.zip" } } }, diff --git a/composer.lock b/composer.lock index 7327319..c799ce7 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": "f9b0a5cf05f0e39a11f132701b9a95b4", + "content-hash": "4252f8c5d568e5b9854a84da162e621c", "packages": [ { "name": "aura/session", @@ -1287,6 +1287,48 @@ } ], "packages-dev": [ + { + "name": "anam/phantomjs-linux-x86-binary", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/anam-hossain/phantomjs-linux-x86-binary.git", + "reference": "cb90cd0e7bd4ad34f52e6834783b1c5adae15014" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/anam-hossain/phantomjs-linux-x86-binary/zipball/cb90cd0e7bd4ad34f52e6834783b1c5adae15014", + "reference": "cb90cd0e7bd4ad34f52e6834783b1c5adae15014", + "shasum": "" + }, + "bin": [ + "bin/phantomjs" + ], + "type": "library", + "autoload": { + "psr-4": { + "Anam\\PhantomLinux\\": "/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Anam hossain", + "email": "enam33@gmail.com" + } + ], + "description": "PhantomJS static linked binary for 64 bit linux systems. Most of Linux distributions are supported including Ubuntu, Debian, Fedora and CentOS.", + "homepage": "http://phantomjs.org/download.html", + "keywords": [ + "binary", + "phantomjs", + "phantomjs binary" + ], + "time": "2016-04-05T05:24:48+00:00" + }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -2114,10 +2156,10 @@ }, { "name": "rg3/youtube-dl", - "version": "2017.12.10", + "version": "2018.01.21", "dist": { "type": "zip", - "url": "https://github.com/rg3/youtube-dl/archive/2017.12.10.zip", + "url": "https://github.com/rg3/youtube-dl/archive/2018.01.21.zip", "reference": null, "shasum": null }, diff --git a/config/config.example.yml b/config/config.example.yml index 9254516..c616db5 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -27,6 +27,9 @@ avconv: vendor/bin/ffmpeg # avconv/ffmpeg logging level. avconvVerbosity: error +# Path to the directory that contains the phantomjs binary. +phantomjsDir: vendor/bin/ + # True to disable URL rewriting uglyUrls: false diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 98fec56..098a6c1 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -197,6 +197,12 @@ class VideoDownloadTest extends TestCase 'f4v', 'edgefcs.net', ], + [ + 'https://openload.co/embed/qTsjMEUtN4U', 'best[protocol^=http]', + 'aup-the-lego-ninjago-movie-2017-1508463762.MP4.mp4-qTsjMEUtN4U', + 'mp4', + 'openload.co' + ] ]; } @@ -282,7 +288,7 @@ class VideoDownloadTest extends TestCase $this->assertObjectHasAttribute('ext', $info); $this->assertObjectHasAttribute('title', $info); $this->assertObjectHasAttribute('extractor_key', $info); - $this->assertObjectHasAttribute('formats', $info); + $this->assertObjectHasAttribute('format', $info); } /**