From 439f66380c1a2fb73c88efdc1d7217c35329e032 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Thu, 29 Mar 2018 13:33:41 +0700 Subject: [PATCH] Instead WIP --- Source/Instead.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Instead.php b/Source/Instead.php index 7da3c4d..f388cec 100644 --- a/Source/Instead.php +++ b/Source/Instead.php @@ -30,4 +30,20 @@ class Instead extends Source { } $this->insteadfeed("http://instead-games.ru/index.php?approved=0"); } + public function checkPage($url) { + return (strpos($url,'http://instead-games.ru/game.php') !== FALSE); + } + public function page($url) { + echo 'Распознана игра INSTEAD.'.PHP_EOL; + $text = $this->get_text($url); + $this->loadStr($text); + unset($text); + $game = new Game; + $game->url = $url; + preg_match('/\s([0-9]{4}\.[01][0-9]\.[0-3][0-9])\s/', $this->dom->filter('#panel')->text(), $matches); + $date = \DateTime::createFromFormat('Y.m.d', $matches[0]); + $date = $date->format('U'); + $game->author = str_replace(trim($gameBlock->filter('span.author')->first()->text()), 'Автор: ', ''); + $game->title = trim($gameBlock->filter('h2')->first()->text()); + } }