Added GameJolt, closed issue #12
This commit is contained in:
parent
d491efe370
commit
4b53e95ef6
29
Source/Gamejolt.php
Normal file
29
Source/Gamejolt.php
Normal 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");
|
||||
}
|
||||
}
|
2
run.php
2
run.php
|
@ -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>';
|
||||
|
|
Reference in a new issue