Better way to get user agent string
This commit is contained in:
parent
1bdfcbeb09
commit
c92ea929a4
1 changed files with 2 additions and 3 deletions
|
@ -115,10 +115,9 @@ class FrontController
|
||||||
$video = $this->download->getJSON($params["url"]);
|
$video = $this->download->getJSON($params["url"]);
|
||||||
|
|
||||||
//Vimeo needs a correct user-agent
|
//Vimeo needs a correct user-agent
|
||||||
$UA = $this->download->getUA();
|
|
||||||
ini_set(
|
ini_set(
|
||||||
'user_agent',
|
'user_agent',
|
||||||
$UA
|
$video->http_headers->{'User-Agent'}
|
||||||
);
|
);
|
||||||
$url_info = parse_url($video->url);
|
$url_info = parse_url($video->url);
|
||||||
if ($url_info['scheme'] == 'rtmp') {
|
if ($url_info['scheme'] == 'rtmp') {
|
||||||
|
@ -161,7 +160,7 @@ class FrontController
|
||||||
header("Content-Type: audio/mpeg");
|
header("Content-Type: audio/mpeg");
|
||||||
passthru(
|
passthru(
|
||||||
'curl '.$this->config->curl_params.
|
'curl '.$this->config->curl_params.
|
||||||
' --user-agent '.escapeshellarg($UA).
|
' --user-agent '.escapeshellarg($video->http_headers->{'User-Agent'}).
|
||||||
' '.escapeshellarg($video->url).
|
' '.escapeshellarg($video->url).
|
||||||
' | '.$this->config->avconv.
|
' | '.$this->config->avconv.
|
||||||
' -v quiet -i - -f mp3 -vn pipe:1'
|
' -v quiet -i - -f mp3 -vn pipe:1'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue