diff --git a/classes/Video.php b/classes/Video.php index 3bfdede..cfea97d 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -10,8 +10,7 @@ use Alltube\Exception\EmptyUrlException; use Alltube\Exception\PasswordException; use Exception; use GuzzleHttp\Client; -use GuzzleHttp\Exception\GuzzleException; -use GuzzleHttp\Psr7\Response; +use Psr\Http\Message\ResponseInterface; use stdClass; use Symfony\Component\Process\Process; @@ -615,10 +614,9 @@ class Video * * @param array $headers HTTP headers of the request * - * @return Response + * @return ResponseInterface * @throws EmptyUrlException * @throws PasswordException - * @throws GuzzleException */ public function getHttpResponse(array $headers = []) { diff --git a/classes/streams/YoutubeChunkStream.php b/classes/streams/YoutubeChunkStream.php index 69ee98a..91ee219 100644 --- a/classes/streams/YoutubeChunkStream.php +++ b/classes/streams/YoutubeChunkStream.php @@ -6,7 +6,7 @@ namespace Alltube\Stream; -use GuzzleHttp\Psr7\Response; +use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; /** @@ -18,16 +18,16 @@ class YoutubeChunkStream implements StreamInterface /** * HTTP response containing the video chunk. * - * @var Response + * @var ResponseInterface */ private $response; /** * YoutubeChunkStream constructor. * - * @param Response $response HTTP response containing the video chunk + * @param ResponseInterface $response HTTP response containing the video chunk */ - public function __construct(Response $response) + public function __construct(ResponseInterface $response) { $this->response = $response; } diff --git a/composer.json b/composer.json index db707a8..adcf9da 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,11 @@ "homepage": "http://alltubedownload.net/", "type": "project", "require": { + "ext-intl": "*", + "ext-json": "*", "aura/session": "~2.1.0", "barracudanetworks/archivestream-php": "~1.0.5", - "guzzlehttp/guzzle": "~6.3.0", + "guzzlehttp/guzzle": "^6.5", "jawira/case-converter": "^3.4", "mathmarques/smarty-view": "~1.1.0", "npm-asset/open-sans-fontface": "^1.4", @@ -16,9 +18,7 @@ "symfony/process": "^4.0", "symfony/translation": "^4.0", "symfony/yaml": "^4.0", - "zonuexe/http-accept-language": "~0.4.1", - "ext-intl": "*", - "ext-json": "*" + "zonuexe/http-accept-language": "~0.4.1" }, "require-dev": { "anam/phantomjs-linux-x86-binary": "~2.1.1", diff --git a/composer.lock b/composer.lock index 8e38216..12f6d4a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e2043abf0f043d0ef514f2e517b3b8fc", + "content-hash": "d6b6d55bcc8f884443734ed9e2b3d94f", "packages": [ { "name": "aura/session", @@ -110,27 +110,29 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.3.3", + "version": "6.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e", + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e", "shasum": "" }, "require": { + "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.11" }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.0" + "psr/log": "^1.1" }, "suggest": { "psr/log": "Required for using the Log middleware" @@ -138,16 +140,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -171,7 +173,7 @@ "rest", "web service" ], - "time": "2018-04-22T15:46:56+00:00" + "time": "2020-04-18T10:38:46+00:00" }, { "name": "guzzlehttp/promises", @@ -914,6 +916,68 @@ ], "time": "2019-11-27T13:56:44+00:00" }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.17.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2020-05-12T16:47:27+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.13.0", @@ -973,6 +1037,61 @@ ], "time": "2019-11-27T14:18:11+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, { "name": "symfony/process", "version": "v4.4.0", @@ -5682,61 +5801,6 @@ ], "time": "2019-11-18T17:27:11+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-11-27T13:56:44+00:00" - }, { "name": "symfony/polyfill-php73", "version": "v1.13.0", diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index b765a39..30f1e27 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -13,7 +13,6 @@ use Alltube\Stream\PlaylistArchiveStream; use Alltube\Stream\YoutubeStream; use Alltube\Video; use Exception; -use GuzzleHttp\Exception\GuzzleException; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\Stream; @@ -149,7 +148,7 @@ class DownloadController extends BaseController * @return Response HTTP response * @throws EmptyUrlException * @throws PasswordException - * @throws GuzzleException + * @throws Exception */ private function getStream(Request $request, Response $response) { @@ -244,7 +243,6 @@ class DownloadController extends BaseController * @param Response $response PSR-7 response * @return Response HTTP response * @throws EmptyUrlException - * @throws GuzzleException * @throws PasswordException * @throws Exception */ diff --git a/tests/YoutubeChunkStreamTest.php b/tests/YoutubeChunkStreamTest.php index fb68c2f..41a2f38 100644 --- a/tests/YoutubeChunkStreamTest.php +++ b/tests/YoutubeChunkStreamTest.php @@ -9,7 +9,6 @@ namespace Alltube\Test; use Alltube\Stream\YoutubeChunkStream; use Alltube\Video; use Exception; -use GuzzleHttp\Exception\GuzzleException; /** * Unit tests for the YoutubeChunkStream class. @@ -20,7 +19,6 @@ class YoutubeChunkStreamTest extends StreamTest /** * Prepare tests. * @throws Exception - * @throws GuzzleException */ protected function setUp(): void {