26 lines
946 B
PHP
26 lines
946 B
PHP
<?php
|
|
namespace Source;
|
|
|
|
use \Game;
|
|
|
|
class Qsp extends Source {
|
|
public $title = "Библиотека QSP";
|
|
protected function parse() {
|
|
$this->dom->loadFromUrl("http://qsp.su/index.php?option=com_sobi2&sobi2Task=rss&no_html=1&catid=1&Itemid=55");
|
|
$games = $this->dom->find('channel item');
|
|
foreach ($games as $gameBlock) {
|
|
$date = trim($gameBlock->find('pubDate')->innerHtml, "() \t\n\r\0\x0B");
|
|
$date = new \DateTime($date);
|
|
if ($date === false) continue;
|
|
$date = $date->format('U');
|
|
if ($date < $this->period) continue;
|
|
$game = new Game;
|
|
$game->author = trim($gameBlock->find('category')->innerHtml);
|
|
$game->title = trim($gameBlock->find('title')->innerHtml);
|
|
$game->url = trim($gameBlock->find('link')[0]->innerHtml);// not working because XML
|
|
$game->description = trim($gameBlock->find('description')->innerHtml);
|
|
$this->output .= $game->print();
|
|
}
|
|
}
|
|
}
|