Квестбук (общая информация)
This commit is contained in:
parent
9d3c766b7c
commit
60420eaff0
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue