diff --git a/classes/Config.php b/classes/Config.php index a003624..d80a657 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -32,6 +32,7 @@ Class Config public $params = '--no-playlist --no-warnings -f best'; public $convert = false; public $avconv = 'vendor/bin/ffmpeg'; + public $curl_params = ''; /** * Config constructor diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 3944b8d..8364278 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -32,8 +32,9 @@ Class VideoDownload static function getUA() { $config = Config::getInstance(); + $cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params); exec( - escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --dump-user-agent', + $cmd.' --dump-user-agent', $version ); return $version[0]; @@ -47,8 +48,9 @@ Class VideoDownload static function listExtractors() { $config = Config::getInstance(); + $cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params); exec( - escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --list-extractors', + $cmd.' --list-extractors', $extractors ); return $extractors; @@ -65,7 +67,7 @@ Class VideoDownload static function getFilename($url, $format=null) { $config = Config::getInstance(); - $cmd = escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl); + $cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params); if (isset($format)) { $cmd .= ' -f '.escapeshellarg($format); } diff --git a/config.example.yml b/config.example.yml index b0c7301..0734d4d 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,5 +1,6 @@ youtubedl: vendor/rg3/youtube-dl/youtube_dl/__main__.py python: /usr/bin/python params: --no-playlist --no-warnings -f best +curl_params: convert: false avconv: vendor/bin/ffmpeg diff --git a/controllers/FrontController.php b/controllers/FrontController.php index de3a8c3..29c8d1a 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -130,7 +130,7 @@ class FrontController ); header("Content-Type: audio/mpeg"); passthru( - 'curl --user-agent '.escapeshellarg($UA). + 'curl '.$config->curl_params.' --user-agent '.escapeshellarg($UA). ' '.escapeshellarg($video->url). ' | '.$config->avconv. ' -v quiet -i - -f mp3 -vn pipe:1'