oreolek
/
news-script
Archived
1
0
Fork 0

Instory WIP

This commit is contained in:
Alexander Yakovlev 2019-02-16 16:12:46 +07:00
parent fe4e547bef
commit fa4d2cb446
Signed by: oreolek
GPG Key ID: 1CDC4B7820C93BD3
2 changed files with 34 additions and 0 deletions

View File

@ -56,4 +56,29 @@ class Instory extends Source {
$this->output .= $game->print();
}
}
public function checkPage($url) {
return (strpos($url,'http://instory.top/') !== FALSE);
}
public function page($url) {
$text = $this->get_text($url);
$this->loadStr($text);
unset($text);
$game = new Game;
$game->url = $url;
$author = trim($this->dom->filter('.elementor-author-box__name')->first()->text());
$date = $this->dom->filter('.elementor-icon-list-text.elementor-post-info__item.elementor-post-info__item--type-date')->first()->text();
$date = str_replace('Дата:', '', $date);
$date = str_replace(' в', '', $date);
$date = new \DateTime($date);
$title = $this->dom->filter('.elementor-heading-title.elementor-size-medium')->first();
if ($title->count() > 0) {
$game->title = htmlspecialchars_decode($title->text());
}
$game->image = $this->dom->filter('.elementor-image > a')->first()->getAttribute('href');
$game->description = $this->dom->filter('.elementor-widget.elementor-widget-theme-post-content > div')->first()->text();
$game->description = str_replace($this->dom->filter('.elementor-widget.elementor-widget-theme-post-content .rcl-rating-box')->first()->text(), '', $game->description);
$game->description = trim($game->description);
return $game;
}
}

View File

@ -68,8 +68,17 @@ class Questbook extends Source {
if ($title->count() > 0) {
$title = $title->first()->text();
$game->title = $title;
} else {
$title = $this->dom->filter('h2.mt-1');
if ($title->count() > 0) {
$title = $title->first()->text();
$game->title = $title;
}
}
$game->platform = 'Книга-игра';
if (strpos($game->url, 'quest-book.ru/online/') !== FALSE) {
$game->platform = 'Атрил';
}
$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;