Skip to content

Commit

Permalink
minor changes in PlayTV and WeebTV scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
K-S-V committed Jun 9, 2013
1 parent 0f45082 commit 718f65b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 42 deletions.
47 changes: 25 additions & 22 deletions PlayTV.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class cURL
function cURL($cookies = true, $cookie = 'Cookies.txt', $compression = 'gzip', $proxy = '')
{
$this->headers = $this->headers();
$this->user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0';
$this->user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0';
$this->compression = $compression;
$this->cookies = $cookies;
if ($this->cookies == true)
Expand Down Expand Up @@ -277,13 +277,16 @@ function cookie($cookie_file)
function get($url)
{
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_ENCODING, $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$options = array(
CURLOPT_HTTPHEADER => $this->headers,
CURLOPT_HEADER => 0,
CURLOPT_USERAGENT => $this->user_agent,
CURLOPT_ENCODING => $this->compression,
CURLOPT_TIMEOUT => 30,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1
);
curl_setopt_array($process, $options);
if (!$this->cert_check)
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
if ($this->cookies == true)
Expand All @@ -303,15 +306,18 @@ function post($url, $data)
$process = curl_init($url);
$headers = $this->headers;
$headers[] = 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8';
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_ENCODING, $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
$options = array(
CURLOPT_HTTPHEADER => $headers,
CURLOPT_HEADER => 1,
CURLOPT_USERAGENT => $this->user_agent,
CURLOPT_ENCODING => $this->compression,
CURLOPT_TIMEOUT => 30,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data
);
curl_setopt_array($process, $options);
if (!$this->cert_check)
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
if ($this->cookies == true)
Expand Down Expand Up @@ -377,10 +383,7 @@ function Display($items, $format, $columns)
if ($cli->getParam('list'))
{
foreach ($items as $name => $url)
{
printf("%-25.20s", preg_replace('/=/', '-', $name));
printf(" = %s\n", $url);
}
printf("%-25.25s = %s\n", preg_replace('/=/', '-', $name), $url);
exit(0);
}

Expand Down Expand Up @@ -599,7 +602,7 @@ function ShowHeader()
if (!$quiet)
ShowHeader();

strncasecmp(php_uname('s'), "Win", 3) == 0 ? $windows = true : $windows = false;
$windows = (strncasecmp(php_uname('s'), "Win", 3) == 0 ? true : false);
if ($windows)
{
exec("chcp 65001");
Expand Down
44 changes: 24 additions & 20 deletions WeebTV.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class cURL
function cURL($cookies = true, $cookie = 'Cookies.txt', $compression = 'gzip', $proxy = '')
{
$this->headers = $this->headers();
$this->user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0';
$this->user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0';
$this->compression = $compression;
$this->cookies = $cookies;
if ($this->cookies == true)
Expand Down Expand Up @@ -129,13 +129,16 @@ function cookie($cookie_file)
function get($url)
{
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_ENCODING, $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$options = array(
CURLOPT_HTTPHEADER => $this->headers,
CURLOPT_HEADER => 0,
CURLOPT_USERAGENT => $this->user_agent,
CURLOPT_ENCODING => $this->compression,
CURLOPT_TIMEOUT => 30,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1
);
curl_setopt_array($process, $options);
if (!$this->cert_check)
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
if ($this->cookies == true)
Expand All @@ -155,15 +158,18 @@ function post($url, $data)
$process = curl_init($url);
$headers = $this->headers;
$headers[] = 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8';
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_ENCODING, $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
$options = array(
CURLOPT_HTTPHEADER => $headers,
CURLOPT_HEADER => 1,
CURLOPT_USERAGENT => $this->user_agent,
CURLOPT_ENCODING => $this->compression,
CURLOPT_TIMEOUT => 30,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data
);
curl_setopt_array($process, $options);
if (!$this->cert_check)
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
if ($this->cookies == true)
Expand Down Expand Up @@ -229,9 +235,7 @@ function Display($items, $format, $columns)
if ($cli->getParam('list'))
{
foreach ($items as $name => $url)
{
printf("%-25.25s = %s\n", preg_replace('/=/', '-', $name), $url);
}
exit(0);
}

Expand Down Expand Up @@ -476,7 +480,7 @@ function ShowHeader()
if (!$quiet)
ShowHeader();

strncasecmp(php_uname('s'), "Win", 3) == 0 ? $windows = true : $windows = false;
$windows = (strncasecmp(php_uname('s'), "Win", 3) == 0 ? true : false);
if ($windows)
{
exec("chcp 65001");
Expand Down

0 comments on commit 718f65b

Please sign in to comment.