Даты на ifiction.ru
This commit is contained in:
parent
b2fbfe3539
commit
af0b53ff56
|
@ -38,7 +38,7 @@ class Ifiction extends Source {
|
||||||
$text = $this->get_text('https://forum.ifiction.ru/viewforum.php?id=36');
|
$text = $this->get_text('https://forum.ifiction.ru/viewforum.php?id=36');
|
||||||
$this->loadStr($text);
|
$this->loadStr($text);
|
||||||
unset($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();
|
$href = $gameBlock->filter('.intd .tclcon a:first-child')->first();
|
||||||
if ($href) {
|
if ($href) {
|
||||||
$href = $href->attr('href');
|
$href = $href->attr('href');
|
||||||
|
@ -47,8 +47,22 @@ class Ifiction extends Source {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$url = $this->baseUrl.trim($href);
|
$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)) {
|
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);
|
$is_list = (strpos($url, '&list=') !== FALSE);
|
||||||
return $is_ifiction && !$is_list;
|
return $is_ifiction && !$is_list;
|
||||||
}
|
}
|
||||||
public function page($url) {
|
public function page($url, $date = NULL) {
|
||||||
$text = $this->get_text($url);
|
$text = $this->get_text($url);
|
||||||
$this->loadStr($text);
|
$this->loadStr($text);
|
||||||
unset($text);
|
unset($text);
|
||||||
$game = new Game;
|
$game = new Game;
|
||||||
$game->url = $url;
|
$game->url = $url;
|
||||||
|
if (empty($date)) {
|
||||||
|
$game->release_date = new \DateTime();
|
||||||
|
} else {
|
||||||
|
$game->release_date = $date;
|
||||||
|
}
|
||||||
$game->url_discussion = $url;
|
$game->url_discussion = $url;
|
||||||
$temp = $this->dom->filter('div.gamecontainer div div.postmsg h1 a b span.light');
|
$temp = $this->dom->filter('div.gamecontainer div div.postmsg h1 a b span.light');
|
||||||
if ($temp->count() > 0) {
|
if ($temp->count() > 0) {
|
||||||
|
|
Reference in a new issue