Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions AdobeHDS.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ function getParam($name)

class cURL
{
var $headers, $user_agent, $compression, $cookie_file;
var $headers, $user_agent, $compression, $cookie_file, $network_interface;
var $active, $cert_check, $fragProxy, $maxSpeed, $proxy, $response;
var $mh, $ch, $mrc;
static $ref = 0;

function __construct($cookies = true, $cookie = 'Cookies.txt', $compression = 'gzip', $proxy = '')
function __construct($cookies = true, $cookie = 'Cookies.txt', $compression = 'gzip', $proxy = '', $network_interface = '')
{
$this->headers = $this->headers();
$this->user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:41.0) Gecko/20100101 Firefox/41.0';
Expand All @@ -115,6 +115,7 @@ function __construct($cookies = true, $cookie = 'Cookies.txt', $compression = 'g
$this->fragProxy = false;
$this->maxSpeed = 0;
$this->proxy = $proxy;
$this->network_interface = $network_interface;
self::$ref++;
}

Expand Down Expand Up @@ -167,6 +168,8 @@ function get($url)
}
if ($this->proxy)
$this->setProxy($process, $this->proxy);
if ($this->network_interface)
curl_setopt($process, CURLOPT_INTERFACE, $this->network_interface);
$this->response = curl_exec($process);
if ($this->response !== false)
$status = curl_getinfo($process, CURLINFO_HTTP_CODE);
Expand Down Expand Up @@ -203,6 +206,8 @@ function post($url, $data)
}
if ($this->proxy)
$this->setProxy($process, $this->proxy);
if ($this->network_interface)
curl_setopt($process, CURLOPT_INTERFACE, $this->network_interface);
$return = curl_exec($process);
curl_close($process);
return $return;
Expand Down Expand Up @@ -263,6 +268,8 @@ function addDownload($url, $id)
}
if ($this->fragProxy and $this->proxy)
$this->setProxy($download['ch'], $this->proxy);
if ($this->network_interface)
curl_setopt($download['ch'], CURLOPT_INTERFACE, $this->network_interface);
if ($this->maxSpeed > 0)
curl_setopt($download['ch'], CURLOPT_MAX_RECV_SPEED_LARGE, $this->maxSpeed);
curl_multi_add_handle($this->mh, $download['ch']);
Expand Down Expand Up @@ -2039,6 +2046,7 @@ function value_in_array_field($needle, $needle_field, $value_field, $haystack, $
'fixwindow' => 'timestamp gap between frames to consider as timeshift',
'manifest' => 'manifest file for downloading of fragments',
'maxspeed' => 'maximum bandwidth consumption (KB) for fragment downloading',
'networkinterface' => 'this can be an interface name, an IP address or a host name',
'outdir' => 'destination folder for output file',
'outfile' => 'filename to use for output file',
'parallel' => 'number of fragments to download simultaneously',
Expand Down Expand Up @@ -2114,6 +2122,8 @@ function value_in_array_field($needle, $needle_field, $value_field, $haystack, $
$manifest = $cli->getParam('manifest');
if ($cli->getParam('maxspeed'))
$maxSpeed = $cli->getParam('maxspeed');
if ($cli->getParam('networkinterface'))
$cc->network_interface = $cli->getParam('networkinterface');
if ($cli->getParam('outdir'))
$outDir = $cli->getParam('outdir');
if ($cli->getParam('outfile'))
Expand Down