Archived
1
0
Fork 0

Даты на ifiction.ru

This commit is contained in:
Alexander Yakovlev 2020-10-20 21:53:05 +07:00
parent b2fbfe3539
commit af0b53ff56
Signed by: oreolek
GPG key ID: 1CDC4B7820C93BD3

View file

@ -38,7 +38,7 @@ class Ifiction extends Source {
$text = $this->get_text('https://forum.ifiction.ru/viewforum.php?id=36');
$this->loadStr($text);
unset($text);
$this->dom->filter('.GameCatalog > tbody > tr')->each(function($gameBlock) {
$this->dom->filter('.box > .inbox > .GameCatalog > tbody > tr')->each(function($gameBlock) {
$href = $gameBlock->filter('.intd .tclcon a:first-child')->first();
if ($href) {
$href = $href->attr('href');
@ -47,8 +47,22 @@ class Ifiction extends Source {
return;
}
$url = $this->baseUrl.trim($href);
if (!$this->checkPage($url)) {
return;
}
$date = NULL;
if ($gameBlock->filter('td:nth-child(3) > small.dark')->count() > 0) {
$datestring = $gameBlock->filter('td:nth-child(3) > small.dark')->text();
if ($datestring === 'Сегодня') {
$datestring = date('d.m.Y');
}
if ($datestring === 'Вчера') {
$datestring = date('d.m.Y', strtotime('-1 day'));
}
$date = new \DateTime($datestring);
}
if ($this->checkPage($url)) {
$this->page($url);
$this->page($url, $date);
}
});
}
@ -57,12 +71,17 @@ class Ifiction extends Source {
$is_list = (strpos($url, '&list=') !== FALSE);
return $is_ifiction && !$is_list;
}
public function page($url) {
public function page($url, $date = NULL) {
$text = $this->get_text($url);
$this->loadStr($text);
unset($text);
$game = new Game;
$game->url = $url;
if (empty($date)) {
$game->release_date = new \DateTime();
} else {
$game->release_date = $date;
}
$game->url_discussion = $url;
$temp = $this->dom->filter('div.gamecontainer div div.postmsg h1 a b span.light');
if ($temp->count() > 0) {