Archived
1
0
Fork 0

Resolved #2: парсер Квестера

This commit is contained in:
Alexander Yakovlev 2017-01-30 18:40:51 +07:00
parent a50f35bc61
commit 6dac83e266
2 changed files with 26 additions and 0 deletions

25
Source/Kvester.php Normal file
View file

@ -0,0 +1,25 @@
<?php
namespace Source;
use \Game;
class Kvester extends Source {
public $title = "Квестер";
protected function parse() {
$this->dom->loadFromUrl("http://kvester.ru/catalog?sort=date");
$games = $this->dom->find('.catalog-item');
foreach ($games as $gameBlock) {
$date = trim($gameBlock->find('.cell-2 .date')->innerHtml, "() \t\n\r\0\x0B");
$date = \DateTime::createFromFormat("d.m.y", $date);
if ($date === false) continue;
$date = $date->format('U');
//if ($date < $this->period) continue;
$game = new Game;
$game->author = trim(strip_tags($gameBlock->find('.cell-2 .author')->innerHtml));
$game->title = trim($gameBlock->find('.cell-2 h3 a')->text);
$game->url = 'http://kvester.ru'.trim($gameBlock->find('.cell-2 h3 a')->getAttribute('href'));
$game->description = "";
$this->output .= $game->print();
}
}
}

View file

@ -6,6 +6,7 @@ $loader->register();
$loader->addPrefix('Source', 'Source');
(new Source\Qsp())->print();
(new Source\Kvester())->print();
(new Source\Apero())->print();
(new Source\Instead())->print();
(new Source\Storymaze())->print();