From 6cd8eeed4a22163c37be7fef04da38a28072e32e Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 26 Sep 2019 21:36:40 +0200 Subject: [PATCH] fix: Use cookies provided by youtube-dl Fixes #225 --- classes/Video.php | 1 + controllers/DownloadController.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/Video.php b/classes/Video.php index 127102c..72072c7 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -27,6 +27,7 @@ use Symfony\Component\Process\Process; * @property-read array $rtmp_conn * @property-read string|null $_type Object type (usually "playlist" or null) * @property-read stdClass $downloader_options + * @property-read stdClass $http_headers */ class Video { diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index ae2631f..5fb2388 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -164,11 +164,11 @@ class DownloadController extends BaseController $response = $response->withHeader('Content-Type', 'video/'.$this->video->ext); $body = new Stream($this->video->getM3uStream()); } else { + $headers = (array) $this->video->http_headers; $range = $request->getHeader('Range'); - if (empty($range)) { - $headers = []; - } else { - $headers = ['Range' => $range]; + + if (!empty($range)) { + $headers['Range'] = $range; } $stream = $this->video->getHttpResponse($headers);