Фильтр уникальности для Itch
This commit is contained in:
parent
361ff14b2a
commit
aa2bab8399
|
@ -6,6 +6,7 @@ use \Pandoc\Pandoc;
|
||||||
|
|
||||||
class Itch extends Source {
|
class Itch extends Source {
|
||||||
public $title = "Itch.io";
|
public $title = "Itch.io";
|
||||||
|
public $games = [];
|
||||||
protected function parse_tag($url) {
|
protected function parse_tag($url) {
|
||||||
$service = new \Sabre\Xml\Service();
|
$service = new \Sabre\Xml\Service();
|
||||||
$xml = $this->get_text($url);
|
$xml = $this->get_text($url);
|
||||||
|
@ -36,7 +37,7 @@ class Itch extends Source {
|
||||||
$game->author = strip_tags($text->nextAll()->first()->html());
|
$game->author = strip_tags($text->nextAll()->first()->html());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$this->output .= $game->print();
|
$this->games[] = $game->print();
|
||||||
return $game;
|
return $game;
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -46,7 +47,12 @@ class Itch extends Source {
|
||||||
}
|
}
|
||||||
protected function parse() {
|
protected function parse() {
|
||||||
$this->parse_tag("https://itch.io/games/newest/tag-text-based.xml");
|
$this->parse_tag("https://itch.io/games/newest/tag-text-based.xml");
|
||||||
|
$this->parse_tag("https://itch.io/games/newest/tag-twine.xml");
|
||||||
$this->parse_tag("https://itch.io/games/newest/tag-interactive-fiction.xml");
|
$this->parse_tag("https://itch.io/games/newest/tag-interactive-fiction.xml");
|
||||||
|
$this->games = array_unique($this->games);
|
||||||
|
foreach ($this->games as $game) {
|
||||||
|
$this->output .= $game;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function checkPage($url) {
|
public function checkPage($url) {
|
||||||
return (strpos($url,'.itch.io/') !== FALSE);
|
return (strpos($url,'.itch.io/') !== FALSE);
|
||||||
|
|
Reference in a new issue