Новости инстеда
This commit is contained in:
parent
dab34de99b
commit
ce8a0386b9
|
@ -7,20 +7,19 @@ class Instead extends Source {
|
|||
public $title = "INSTEAD репозиторий";
|
||||
protected function insteadfeed($url) {
|
||||
$text = $this->get_text($url);
|
||||
$this->dom->loadStr($text, []);
|
||||
$this->loadStr($text);
|
||||
unset($text);
|
||||
$games = $this->dom->find('.game');
|
||||
foreach ($games as $gameBlock) {
|
||||
$date = trim($gameBlock->find('.b .date b')->innerHtml);
|
||||
$this->dom->filter('.game')->each(function($gameBlock) {
|
||||
$date = trim($gameBlock->filter('.b .date b')->text());
|
||||
$date = \DateTime::createFromFormat('Y.m.d', $date);
|
||||
$date = $date->format('U');
|
||||
if ($date < $this->period) continue;
|
||||
if ($date < $this->period) return;
|
||||
$game = new Game;
|
||||
$game->author = str_replace(trim($gameBlock->find('span.author')->innerHtml), 'Автор: ', '');
|
||||
$game->title = trim($gameBlock->find('h2')[0]->find('a')[0]->innerHtml);
|
||||
$game->url = 'http://instead-games.ru/'.trim($gameBlock->find('h2')[0]->find('a')[0]->getAttribute('href'));
|
||||
$game->author = str_replace(trim($gameBlock->filter('span.author')->first()->text()), 'Автор: ', '');
|
||||
$game->title = trim($gameBlock->filter('h2:first-child a:first-child')->first()->text());
|
||||
$game->url = 'http://instead-games.ru/'.trim($gameBlock->filter('h2:first-child a:first-child')->first()->attr('href'));
|
||||
$this->output .= $game->print();
|
||||
}
|
||||
});
|
||||
}
|
||||
protected function parse() {
|
||||
$this->insteadfeed("http://instead-games.ru/");
|
||||
|
|
Reference in a new issue