diff --git a/Source/Qsp.php b/Source/Qsp.php index 81fb401..828f44d 100644 --- a/Source/Qsp.php +++ b/Source/Qsp.php @@ -7,21 +7,20 @@ class Qsp extends Source { public $title = "Библиотека QSP"; protected function parse() { $text = $this->get_text("http://qsp.su/index.php?option=com_sobi2&sobi2Task=rss&no_html=1&catid=1&Itemid=55"); - $this->dom->loadStr($text, []); + $this->loadStr($text); unset($text); - $games = $this->dom->find('channel item'); - foreach ($games as $gameBlock) { - $date = trim($gameBlock->find('pubDate')->innerHtml, "() \t\n\r\0\x0B"); + $this->dom->filter('channel item')->each(function($gameBlock){ + $date = trim($gameBlock->filter('pubDate')->text(), "() \t\n\r\0\x0B"); $date = new \DateTime($date); - if ($date === false) continue; + if ($date === false) return; $date = $date->format('U'); - if ($date < $this->period) continue; + if ($date < $this->period) return; $game = new Game; - $game->author = trim($gameBlock->find('category')->innerHtml); - $game->title = trim($gameBlock->find('title')->innerHtml); - $game->url = trim($gameBlock->find('link')[0]->innerHtml);// not working because XML - $game->description = trim($gameBlock->find('description')->innerHtml); + $game->author = trim($gameBlock->filter('category')->text()); + $game->title = trim($gameBlock->filter('title')->text()); + $game->url = trim($gameBlock->filter('link:first-child')->text()); + $game->description = trim($gameBlock->filter('description')->text()); $this->output .= $game->print(); - } + }); } } diff --git a/run.php b/run.php index f7de394..fbf5575 100755 --- a/run.php +++ b/run.php @@ -21,12 +21,11 @@ if (PHP_SAPI !== 'cli') { } if ($parsers === 'all' || in_array('all', $parsers)) { $parsers = [ - // 'urq', + 'urq', 'anivisual', 'kvester', 'apero', 'instead', - //'storymaze', 'hyperbook_ru', 'hyperbook_en', 'questbook', @@ -47,12 +46,11 @@ function check($classname, $command) { } } -//check ('Urq', 'urq'); +check ('Urq', 'urq'); check ('Qsp', 'qsp'); check ('Kvester', 'kvester'); check ('Apero', 'apero'); check ('Instead', 'instead'); -check ('Storymaze', 'storymaze'); check ('Hyperbook', 'hyperbook_ru'); check ('Questbook', 'questbook'); check ('Anivisual', 'anivisual');