From d491efe370bd6050895f65eebe95e50453ecf537 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 15 Sep 2017 22:11:55 +0700 Subject: [PATCH] Added anivisual.net --- Source/Anivisual.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ run.php | 4 +++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 Source/Anivisual.php diff --git a/Source/Anivisual.php b/Source/Anivisual.php new file mode 100644 index 0000000..dd69e2e --- /dev/null +++ b/Source/Anivisual.php @@ -0,0 +1,51 @@ + '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(); + } + } +} diff --git a/run.php b/run.php index a695923..7e2e57e 100755 --- a/run.php +++ b/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');