Update adult classes

This commit is contained in:
DariusIII
2017-06-09 00:02:25 +02:00
parent 4348434ecf
commit 40cba044a6
9 changed files with 49 additions and 172 deletions
+2 -1
View File
@@ -6,7 +6,8 @@
],
"autoload": {
"files": [
"app/libraries/laravel/framework/src/Illuminate/Support/helpers.php"
"app/libraries/laravel/framework/src/Illuminate/Support/helpers.php",
"app/extensions/helper/helpers.php"
],
"psr-4": {
"nntmux\\": "nntmux/"
+7 -73
View File
@@ -1,16 +1,14 @@
<?php
namespace nntmux;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use nntmux\db\DB;
use nntmux\utility\Utility;
use nntmux\processing\adult\AdultMovies;
/**
* Class adultdvdempire
*/
class ADE
class ADE extends AdultMovies
{
/**
* If a direct link is given parse it rather then search
@@ -72,22 +70,11 @@ class ADE
protected $_edithtml;
protected $_ch;
/**
* @var Client
*/
protected $client;
/**
* @var DB
*/
protected $pdo;
public function __construct()
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_html = new \simple_html_dom();
$this->_edithtml = new \simple_html_dom();
$this->client = new Client();
$this->pdo = new DB();
}
/**
@@ -295,9 +282,8 @@ class ADE
if (empty($this->searchTerm)) {
return false;
}
if ($this->getUrl($this->_dvdQuery . rawurlencode($this->searchTerm)) === false) {
return false;
} else {
$this->_response = getUrl($this->_dvdQuery . rawurlencode($this->searchTerm));
if ($this->_response !== false) {
$this->_html->load($this->_response);
if ($ret = $this->_html->find('a.boxcover', 0)) {
$title = $ret->title;
@@ -312,7 +298,7 @@ class ADE
$this->_title = trim($title);
unset($ret);
$this->_html->clear();
$this->getUrl($this->_urlFound);
getUrl($this->_urlFound);
$this->_html->load($this->_response);
} else {
$this->found = false;
@@ -326,58 +312,6 @@ class ADE
return false;
}
/**
* Gets raw html content using adeurl and any trailing url.
*
* @param string $trailing - required
*
* @return bool - true if page has content
*/
private function getUrl($trailing = "")
{
if (!empty($trailing)) {
try {
$this->_response = $this->client->get(self::ADE . $trailing)->getBody()->getContents();
} catch (RequestException $e) {
if ($e->hasResponse()) {
if($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on ADE server'));
} else if ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('ADE service unavailable'));
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from ADE, http error reported: ' . $e->getCode()));
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: ' . $e->getCode()));
}
}
if (!empty($this->directLink)) {
try {
$this->_response = $this->client->get($this->directLink)->getBody()->getContents();
$this->directLink = '';
} catch (RequestException $e) {
if ($e->hasResponse()) {
if($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on ADE server'));
} else if ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('ADE service unavailable'));
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from ADE, http error reported: ' . $e->getCode()));
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: ' . $e->getCode()));
}
}
if (!$this->_response) {
return false;
}
return $this->_response;
}
/**
* Gets All Information from the methods
*
+9 -79
View File
@@ -1,14 +1,10 @@
<?php
namespace nntmux;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Cookie\SetCookie;
use GuzzleHttp\Exception\RequestException;
use nntmux\db\DB;
use nntmux\utility\Utility;
use nntmux\processing\adult\AdultMovies;
class ADM
class ADM extends AdultMovies
{
/**
* Override if 18 years+ or older
@@ -50,21 +46,6 @@ class ADM
*/
protected $_html;
/**
* @var Client
*/
protected $client;
/**
* @var DB
*/
protected $pdo;
/**
* POST Paramaters for getUrl Method
*/
protected $_postParams;
/**
* Results returned from each method
*
@@ -90,16 +71,11 @@ class ADM
*/
protected $_title = '';
public function __construct()
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_html = new \simple_html_dom();
$this->client = new Client();
$this->cookiejar = new CookieJar();
$this->pdo = new DB();
if (!empty($this->cookie)) {
$cookieJar = $this->cookiejar->setCookie(SetCookie::fromString($this->cookie));
$this->client = new Client(['cookies' => $cookieJar]);
}
}
/**
@@ -133,6 +109,7 @@ class ADM
/**
* Gets the synopsis
*
* @return array
*/
public function synopsis()
@@ -148,7 +125,7 @@ class ADM
}
/**
* Get Product Informtion and Director
* Get Product Information and Director
*
*
* @return array
@@ -224,7 +201,9 @@ class ADM
$result = false;
if (!empty($this->searchTerm)) {
$this->_trailUrl = self::TRAILINGSEARCH . urlencode($this->searchTerm);
if ($this->getUrl() !== false) {
$this->_response = getUrl(self::ADMURL . $this->_trailUrl);
if ($this->_response !== false) {
$this->_html->load($this->_response);
if ($ret = $this->_html->find('img[rel=license]')) {
if (count($ret) > 0) {
foreach ($this->_html->find('img[rel=license]') as $ret) {
@@ -287,53 +266,4 @@ class ADM
$results = empty($results) ? false : $results;
return $results;
}
/**
* Get Raw html of webpage
*
* @return bool
*/
private function getUrl()
{
if (!empty($this->_trailUrl)) {
try {
$this->_response = $this->client->get(self::ADMURL . $this->_trailUrl)->getBody()->getContents();
} catch (RequestException $e) {
if ($e->hasResponse()) {
if($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on ADM server'));
} else if ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('ADM Service unavailable'));
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from ADM, http error reported: ' . $e->getCode()));
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: ' . $e->getCode()));
}
} else {
try {
$this->_response = $this->client->get(self::IF18)->getBody()->getContents();
} catch (RequestException $e) {
if ($e->hasResponse()) {
if($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on ADM server'));
} else if ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('ADM service unavailable'));
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from ADM, http error reported: ' . $e->getCode()));
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: ' . $e->getCode()));
}
}
if (!$this->_response) {
return false;
}
$this->_html->load($this->_response);
return true;
}
}
+4 -2
View File
@@ -6,8 +6,9 @@ use GuzzleHttp\Cookie\SetCookie;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Client;
use nntmux\db\DB;
use nntmux\processing\adult\AdultMovies;
class AEBN
class AEBN extends AdultMovies
{
/**
* Cookie File location used in curl
@@ -119,8 +120,9 @@ class AEBN
* Sets the variables that used throughout the class
*
*/
public function __construct()
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_whichSite = ['straight' => self::AEBNSURL, 'gay' => self::AEBNGURL];
$this->_html = new \simple_html_dom();
$this->client = new Client();
+1 -1
View File
@@ -6,7 +6,7 @@ namespace nntmux\processing\adult;
use nntmux\ColorCLI;
use nntmux\XXX;
class AdultMovies extends XXX
abstract class AdultMovies extends XXX
{
// Television Sources
const SOURCE_NONE = 0;
+10 -4
View File
@@ -1,7 +1,9 @@
<?php
namespace nntmux;
class Hotmovies
use nntmux\processing\adult\AdultMovies;
class Hotmovies extends AdultMovies
{
/**
@@ -78,10 +80,14 @@ class Hotmovies
*/
protected $_title = '';
public function __construct()
/**
* Hotmovies constructor.
*
* @param array $options
*/
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_html = new \simple_html_dom();
// Set a cookie to override +18 warning.
+4 -2
View File
@@ -1,9 +1,10 @@
<?php
namespace nntmux;
use nntmux\processing\adult\AdultMovies;
use nntmux\utility\Utility;
class IAFD
class IAFD extends AdultMovies
{
public $classUsed = '';
public $cookie = '';
@@ -24,8 +25,9 @@ class IAFD
protected $_response;
public function __construct()
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_html = new \simple_html_dom();
if (!empty($this->cookie)) {
@$this->getUrl();
+4 -2
View File
@@ -1,9 +1,10 @@
<?php
namespace nntmux;
use nntmux\processing\adult\AdultMovies;
use nntmux\utility\Utility;
class Popporn
class Popporn extends AdultMovies
{
/**
@@ -70,8 +71,9 @@ class Popporn
*/
protected $_trailUrl = "";
public function __construct()
public function __construct(array $options = [])
{
parent::__construct($options);
$this->_html = new \simple_html_dom();
if (isset($this->cookie)) {
$this->getUrl();
+8 -8
View File
@@ -413,7 +413,7 @@ class Utility
if ($verify && NN_SSL_VERIFY_HOST && (!empty(NN_SSL_CAFILE) || !empty(NN_SSL_CAPATH))) {
$options += [
CURLOPT_SSL_VERIFYPEER => (bool)NN_SSL_VERIFY_PEER,
CURLOPT_SSL_VERIFYHOST => (NN_SSL_VERIFY_HOST ? 2 : 0),
CURLOPT_SSL_VERIFYHOST => NN_SSL_VERIFY_HOST ? 2 : 0,
];
if (!empty(NN_SSL_CAFILE)) {
$options += [CURLOPT_CAINFO => NN_SSL_CAFILE];
@@ -466,24 +466,24 @@ class Utility
switch ($options['language']) {
case 'fr':
case 'fr-fr':
$options['language'] = "fr-fr";
$options['language'] = 'fr-fr';
break;
case 'de':
case 'de-de':
$options['language'] = "de-de";
$options['language'] = 'de-de';
break;
case 'en-us':
$options['language'] = "en-us";
$options['language'] = 'en-us';
break;
case 'en-gb':
$options['language'] = "en-gb";
$options['language'] = 'en-gb';
break;
case '':
case 'en':
default:
$options['language'] = 'en';
}
$header[] = "Accept-Language: " . $options['language'];
$header[] = 'Accept-Language: ' . $options['language'];
if (is_array($options['requestheaders'])) {
$header += $options['requestheaders'];
}
@@ -526,9 +526,9 @@ class Utility
if ($err !== 0) {
return false;
} else {
return $buffer;
}
return $buffer;
}