Archived
1
0
Fork 0

steam and gamejolt fixes

This commit is contained in:
Alexander Yakovlev 2017-12-15 13:05:23 +07:00
parent 3bcd32c5ad
commit fe45c2a2a2
2 changed files with 15 additions and 14 deletions

View file

@ -8,6 +8,7 @@ class Gamejolt extends Source {
protected function parse_tag($url) {
$data = json_decode($this->get_text($url));
$games = $data->payload->games;
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));
@ -23,6 +24,7 @@ class Gamejolt extends Source {
$this->output .= $game->print();
}
}
}
protected function parse() {
$this->parse_tag("https://gamejolt.com/site-api/web/library/games/tag/twine");
$this->parse_tag("https://gamejolt.com/site-api/web/library/games/tag/renpy");

View file

@ -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]');