steam and gamejolt fixes
This commit is contained in:
parent
3bcd32c5ad
commit
fe45c2a2a2
|
@ -8,19 +8,21 @@ class Gamejolt extends Source {
|
|||
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 / 1000;
|
||||
$game->description = $descData->payload->metaDescription;
|
||||
$game->url = 'https://gamejolt.com/games/'.$gameData->slug.'/'.$gameData->id;
|
||||
if ($game->date < $this->period) {
|
||||
continue;
|
||||
if (count($games) > 0) {
|
||||
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 / 1000;
|
||||
$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();
|
||||
}
|
||||
$this->output .= $game->print();
|
||||
}
|
||||
}
|
||||
protected function parse() {
|
||||
|
|
|
@ -27,13 +27,12 @@ class Steam extends Source {
|
|||
foreach ($games as $gameLink) {
|
||||
$url = $gameLink->getAttribute('href');
|
||||
$url = substr($url,0,strpos($url, '?')); // remove query string
|
||||
game = new Game;
|
||||
$game = new Game;
|
||||
$game->url = $url;
|
||||
try {
|
||||
$text = $this->get_text($url);
|
||||
$this->dom = new Dom;
|
||||
$this->dom->loadStr($text, []);
|
||||
var_dump($text);
|
||||
unset($text);
|
||||
$name = $this->dom->find('div.apphub_AppName');
|
||||
$description = $this->dom->find('meta[property=og:description]');
|
||||
|
|
Reference in a new issue