Added anivisual.net
This commit is contained in:
parent
5416b153ae
commit
d491efe370
51
Source/Anivisual.php
Normal file
51
Source/Anivisual.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
namespace Source;
|
||||
|
||||
use \Game;
|
||||
|
||||
class Anivisual extends Source {
|
||||
public $title = "Anivisual";
|
||||
protected $months = [
|
||||
'Января' => 'January',
|
||||
'Февраля' => 'February',
|
||||
'Марта' => 'March',
|
||||
'Апреля' => 'April',
|
||||
'Мая' => 'May',
|
||||
'Июня' => 'June',
|
||||
'Июля' => 'July',
|
||||
'Августа' => 'August',
|
||||
'Сентября' => 'September',
|
||||
'Октября' => 'October',
|
||||
'Ноября' => 'November',
|
||||
'Декабря' => 'December',
|
||||
];
|
||||
protected function parse() {
|
||||
$text = $this->get_text('http://anivisual.net/stuff/1');
|
||||
try {
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
}
|
||||
unset($text);
|
||||
$games = $this->dom->find('.entryBlock');
|
||||
foreach ($games as $gameBlock) {
|
||||
$date = trim($gameBlock->find('.icon-calendar')->innerHtml);
|
||||
foreach ($this->months as $ruM => $enM) {
|
||||
$date = str_replace($ruM, $enM, $date);
|
||||
}
|
||||
$date = \DateTime::createFromFormat('d F Y', $date);
|
||||
$date = $date->format('U');
|
||||
if ($date < $this->period) continue;
|
||||
$game = new Game;
|
||||
$link = $gameBlock->find('.novel-ttl a')[0];
|
||||
$game->title = $link->innerHtml;
|
||||
$game->url = $link->getAttribute('href');
|
||||
|
||||
$games[] = $game;
|
||||
|
||||
$this->output .= $game->print();
|
||||
}
|
||||
}
|
||||
}
|
4
run.php
4
run.php
|
@ -21,7 +21,8 @@ if (PHP_SAPI !== 'cli') {
|
|||
}
|
||||
if ($parsers === 'all' || in_array('all', $parsers)) {
|
||||
$parsers = [
|
||||
// 'urq',
|
||||
// 'urq',
|
||||
'anivisual',
|
||||
'kvester',
|
||||
'apero',
|
||||
'instead',
|
||||
|
@ -52,6 +53,7 @@ check ('Instead', 'instead');
|
|||
check ('Storymaze', 'storymaze');
|
||||
check ('Hyperbook', 'hyperbook_ru');
|
||||
check ('Questbook', 'questbook');
|
||||
check ('Anivisual', 'anivisual');
|
||||
// ------- English online libraries
|
||||
check ('HyperbookEn', 'hyperbook_en');
|
||||
check ('Textadventures', 'textadventures');
|
||||
|
|
Reference in a new issue