Apero fixes
This commit is contained in:
parent
6a3c912940
commit
41be2895b2
15
Source.php
15
Source.php
|
@ -83,13 +83,20 @@ abstract class Source {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_text($url) {
|
public function get_text($url, $post = []) {
|
||||||
$client = new GuzzleClient([
|
$client = new GuzzleClient([
|
||||||
'timeout' => 30,
|
'timeout' => 30,
|
||||||
]);
|
]);
|
||||||
$response = $client->request('GET', $url, [
|
if ($post === []) {
|
||||||
'cookies' => $this->cookies,
|
$response = $client->request('GET', $url, [
|
||||||
]);
|
'cookies' => $this->cookies,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$response = $client->request('POST', $url, [
|
||||||
|
'form_params' => $post,
|
||||||
|
'cookies' => $this->cookies,
|
||||||
|
]);
|
||||||
|
}
|
||||||
return (string) $response->getBody();
|
return (string) $response->getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,15 @@ use \Game;
|
||||||
class Apero extends Source {
|
class Apero extends Source {
|
||||||
public $title = "Apero";
|
public $title = "Apero";
|
||||||
protected function parse() {
|
protected function parse() {
|
||||||
$text = $this->get_text('http://apero.ru/Текстовые-игры/Песочница');
|
$text = $this->get_text('http://apero.ru/Текстовые-игры/Песочница', [
|
||||||
|
'order_by' => 'by_public',
|
||||||
|
]);
|
||||||
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
|
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
|
||||||
$this->loadStr($text);
|
$this->loadStr($text);
|
||||||
$this->parseIndex();
|
$this->parseIndex();
|
||||||
$text = $this->get_text('http://apero.ru/Текстовые-игры');
|
$text = $this->get_text('http://apero.ru/Текстовые-игры', [
|
||||||
|
'order_by' => 'by_public',
|
||||||
|
]);
|
||||||
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
|
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
|
||||||
$this->loadStr($text);
|
$this->loadStr($text);
|
||||||
$this->parseIndex();
|
$this->parseIndex();
|
||||||
|
|
Reference in a new issue