diff --git a/Source/Hyperbook.php b/Source/Hyperbook.php index 2cd995f..d12cb76 100644 --- a/Source/Hyperbook.php +++ b/Source/Hyperbook.php @@ -48,4 +48,34 @@ class Hyperbook extends Source { $this->output .= $game->print(); } } + public function checkPage($url) { + return (strpos($url,$this->rootUrl.'/comments.php') !== FALSE); + } + public function page($url) { + $text = $this->get_text($url); + $this->loadStr($text); + $game = new Game; + $game->url = $url; + $game->platform = 'AXMA Story Maker'; + $game->title = $this->dom->filter(".content h1")->first()->text(); + $game->title = trim(str_replace($this->dom->filter("h1 span")->first()->text(), '', $game->title)); + $game->author = $this->dom->filter(".content > div")->reduce(function($node) { + if ($node->attr('style') === 'float: left; width: 50%; margin-bottom:14px; text-align: left;') { + return true; + } + return false; + })->first()->text(); + $game->date = $this->dom->filter(".content div.small")->reduce(function($node) { + if ($node->attr('style') === 'float: left; width: 20%; text-align:right;') + return true; + return false; + })->first()->text(); + $game->description = $this->dom->filter(".content div.small")->reduce(function($node) { + if ($node->attr('style') === NULL) + return true; + return false; + })->first()->text(); + $game->date = \DateTime::createFromFormat('d.m.y', $game->date); + return $game; + } }