Archived
1
0
Fork 0
This repository has been archived on 2020-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
news-script/Source/Kvester.php

31 lines
1 KiB
PHP
Raw Normal View History

<?php
namespace Source;
use \Game;
class Kvester extends Source {
public $title = "Квестер";
protected function parse() {
2017-07-13 18:07:14 +03:00
$text = $this->get_text("http://kvester.ru/catalog?sort=date");
2018-03-24 21:45:01 +02:00
$this->loadStr($text);
2017-07-13 18:07:14 +03:00
unset($text);
2018-03-24 21:45:01 +02:00
$this->dom->filter('.catalog-item')->each(function($gameBlock){
$date = trim($gameBlock->filter('.cell-2 .date')->text(), "() \t\n\r\0\x0B");
$date = \DateTime::createFromFormat("d.m.y", $date);
2018-03-24 21:45:01 +02:00
if ($date === false) return;
$date = $date->format('U');
2018-03-24 21:45:01 +02:00
if ($date < $this->period) return;
$game = new Game;
2018-03-24 21:45:01 +02:00
$game->author = trim(strip_tags($gameBlock->filter('.cell-2 .author')->text()));
$game->title = trim($gameBlock->filter('.cell-2 h3 a')->text());
$game->url = 'http://kvester.ru'.trim($gameBlock->filter('.cell-2 h3 a')->attr('href'));
$game->description = "";
2018-03-24 21:45:01 +02:00
$this->loadStr($this->get_text($game->url), []);
$game->description = $this->dom->filter('.description')->first()->text();
$this->output .= $game->print();
2018-03-24 21:45:01 +02:00
});
}
}