diff --git a/Source/Questbook.php b/Source/Questbook.php index b0a780d..0c244bb 100644 --- a/Source/Questbook.php +++ b/Source/Questbook.php @@ -34,4 +34,24 @@ class Questbook extends Source { $this->output .= $game->print(); } } + public function checkPage($url) { + return (strpos($url,'https://quest-book.ru/directory/') !== FALSE); + } + public function page($url) { + $game = new Game; + $game->url = $url; + $game->title = $this->dom->filter('h2 a b')->first()->text(); + $game->description = $this->dom->filter('div.col-md-8.col-sm-12 > div > div')->reduce(function($node) { + if ($node->attr('style') === 'padding:5px;margin:2px;text-align:justify') + return true; + return false; + })->text(); + $game->description = trim($game->description); + $game->author = $this->dom->filter('div.col-md-8.col-sm-12 em span')->reduce(function($node) { + if ($node->attr('itemprop') === 'author') + return true; + return false; + })->text(); + return $game; + } }