1
0
mirror of https://github.com/Rudloff/alltube.git synced 2024-06-20 06:46:40 +02:00

fix: Throw an error when trying to convert a playlist

This commit is contained in:
Pierre Rudloff 2018-05-23 21:50:06 +02:00
parent 647eed9db0
commit 17b9185e53

View File

@ -152,7 +152,13 @@ class VideoDownload
* */
public function getURL($url, $format = null, $password = null)
{
return explode("\n", $this->getProp($url, $format, 'get-url', $password));
$urls = explode("\n", $this->getProp($url, $format, 'get-url', $password));
if (empty($urls[0])) {
throw new Exception(_('youtube-dl returned an empty URL.'));
}
return $urls;
}
/**
@ -325,6 +331,11 @@ class VideoDownload
public function getAudioStream($url, $format, $password = null)
{
$video = $this->getJSON($url, $format, $password);
if (isset($video->_type) && $video->_type == 'playlist') {
throw new Exception(_('Conversion of playlists is not supported.'));
}
if (in_array($video->protocol, ['m3u8', 'm3u8_native'])) {
throw new Exception(_('Conversion of M3U8 files is not supported.'));
} elseif ($video->protocol == 'http_dash_segments') {