Archived
1
0
Fork 0

Удалил Storymaze

This commit is contained in:
Alexander Yakovlev 2018-03-25 02:48:43 +07:00
parent ba125c680c
commit 40fc02bfcb

View file

@ -1,40 +0,0 @@
<?php
namespace Source;
use \Game;
class Storymaze extends Source {
public $title = "Storymaze";
protected function parse() {
$api = $this->get_text('http://storymaze.ru/api/stories/search?count=10&offset=0&asc=');
$api = json_decode($api, TRUE);
if (empty($api)) {
return;
}
foreach ($api as $gameData) {
$date = strtotime($gameData['publishStart']);
if ($date < $this->period) continue;
$game = new Game;
$game->title = $gameData['name'];
$game->url = "http://storymaze.ru/story/view/".$gameData['id'].".html";
$game->description = $gameData['description'];
if (strpos($gameData['description'], '...</a>') !== FALSE) { // описание укорочено
$text = $this->get_text($game->url);
$this->dom->loadStr($text, []);
unset($text);
$storytext = $this->dom->find('.story-text p');
$description = "";
$length = count($storytext);
foreach ($storytext as $text) {
if($text->getAttribute('class') === 'story-name') {
continue;
}
$description .= trim($text->innerHtml);
}
$game->description = $description;
}
$game->author = $gameData['authorName'];
$this->output .= $game->print();
}
}
}