Archived
1
0
Fork 0

Added GameJolt, closed issue #12

This commit is contained in:
Alexander Yakovlev 2017-10-07 15:05:16 +07:00
parent d491efe370
commit 4b53e95ef6
2 changed files with 31 additions and 0 deletions

29
Source/Gamejolt.php Normal file
View file

@ -0,0 +1,29 @@
<?php
namespace Source;
use \Game;
class Gamejolt extends Source {
public $title = "GameJolt";
protected function parse_tag($url) {
$data = json_decode($this->get_text($url));
$games = $data->payload->games;
foreach ($games as $gameData) {
$descUrl = 'https://gamejolt.com/site-api/web/discover/games/overview/'.$gameData->id;
$descData = json_decode($this->get_text($descUrl));
$game = new Game;
$game->title = $gameData->title;
$game->author = $gameData->developer->display_name;
$game->date = $gameData->published_on;
$game->description = $descData->payload->metaDescription;
$game->url = 'https://gamejolt.com/games/'.$gameData->slug.'/'.$gameData->id;
if ($game->date < $this->period) {
continue;
}
$this->output .= $game->print();
}
}
protected function parse() {
$this->parse_tag("https://gamejolt.com/site-api/web/library/games/tag/twine");
}
}

View file

@ -34,6 +34,7 @@ if ($parsers === 'all' || in_array('all', $parsers)) {
'ifdb',
'dashingdon',
'itch',
'gamejolt',
];
}
@ -60,6 +61,7 @@ check ('Textadventures', 'textadventures');
check ('IFDB', 'ifdb');
//check ('Dashingdon', 'dashingdon');
check ('Itch', 'itch');
check ('Gamejolt', 'gamejolt');
if (PHP_SAPI !== 'cli') {
echo '</pre></code></body></html>';