parent
026e716025
commit
fe4e547bef
|
@ -64,19 +64,31 @@ class Questbook extends Source {
|
|||
public function page($url) {
|
||||
$game = new Game;
|
||||
$game->url = $url;
|
||||
$game->title = $this->dom->filter('h2 a b')->first()->text();
|
||||
$title = $this->dom->filter('h2 a b');
|
||||
if ($title->count() > 0) {
|
||||
$title = $title->first()->text();
|
||||
$game->title = $title;
|
||||
}
|
||||
$game->platform = 'Книга-игра';
|
||||
$game->description = $this->dom->filter('div.col-md-8.col-sm-12 > div > div')->reduce(function($node) {
|
||||
$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();
|
||||
});
|
||||
if ($description->count() > 0) {
|
||||
$description = $description->text();
|
||||
$game->description = $description;
|
||||
}
|
||||
$game->description = trim($game->description);
|
||||
$game->author = $this->dom->filter('div.col-md-8.col-sm-12 em span')->reduce(function($node) {
|
||||
$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();
|
||||
});
|
||||
if ($author->count() > 0) {
|
||||
$author = $author->text();
|
||||
$game->author = $author;
|
||||
}
|
||||
return $game;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,11 @@ class Wikipage {
|
|||
$pagetitle = strtr($this->game->title, [
|
||||
'|' => '-'
|
||||
]);
|
||||
if (empty($pagetitle)) {
|
||||
echo 'ERROR: Page has no title.';
|
||||
var_dump($this->game);
|
||||
die();
|
||||
}
|
||||
$exists = $this->exists($pagetitle);
|
||||
if (!$config['DRY_RUN'] && !$exists) {
|
||||
if (!empty($this->game->image)) {
|
||||
|
|
Reference in New Issue