From 60420eaff0c4b1a7fc96f895fb7983095161a332 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Tue, 3 Apr 2018 18:51:07 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=B2=D0=B5=D1=81=D1=82=D0=B1=D1=83?= =?UTF-8?q?=D0=BA=20(=D0=BE=D0=B1=D1=89=D0=B0=D1=8F=20=D0=B8=D0=BD=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Questbook.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; + } }