fix: Fix downloading a playlist as a TAR archive

This is the only time where youtube-dl returning an empty URL is not a problem.
This commit is contained in:
Pierre Rudloff 2018-05-23 22:38:15 +02:00
parent 17b9185e53
commit edf4d4644d
3 changed files with 30 additions and 6 deletions

View file

@ -6,6 +6,7 @@
namespace Alltube\Controller;
use Alltube\Config;
use Alltube\EmptyUrlException;
use Alltube\Locale;
use Alltube\LocaleManager;
use Alltube\PasswordException;
@ -456,11 +457,19 @@ class FrontController
*/
private function getRedirectResponse($url, $format, Response $response, Request $request)
{
$videoUrls = $this->download->getURL(
$url,
$format,
$this->sessionSegment->getFlash($url)
);
try {
$videoUrls = $this->download->getURL(
$url,
$format,
$this->sessionSegment->getFlash($url)
);
} catch (EmptyUrlException $e) {
/*
If this happens it is probably a playlist
so it will either be handle by getStream() or throw an exception anyway.
*/
$videoUrls = [];
}
if (count($videoUrls) > 1) {
return $this->getRemuxStream($videoUrls, $format, $response, $request);
} elseif ($this->config->stream) {