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/Qsp.php

28 lines
1,000 B
PHP

<?php
namespace Source;
use \Game;
class Qsp extends Source {
public $title = "Библиотека QSP";
protected function parse() {
$text = $this->get_text("http://qsp.su/index.php?option=com_sobi2&sobi2Task=rss&no_html=1&catid=1&Itemid=55");
$this->dom->loadStr($text, []);
unset($text);
$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();
}
}
}