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) {
|
protected function parse_tag($url) {
|
||||||
$data = json_decode($this->get_text($url));
|
$data = json_decode($this->get_text($url));
|
||||||
$games = $data->payload->games;
|
$games = $data->payload->games;
|
||||||
foreach ($games as $gameData) {
|
if (count($games) > 0) {
|
||||||
$descUrl = 'https://gamejolt.com/site-api/web/discover/games/overview/'.$gameData->id;
|
foreach ($games as $gameData) {
|
||||||
$descData = json_decode($this->get_text($descUrl));
|
$descUrl = 'https://gamejolt.com/site-api/web/discover/games/overview/'.$gameData->id;
|
||||||
$game = new Game;
|
$descData = json_decode($this->get_text($descUrl));
|
||||||
$game->title = $gameData->title;
|
$game = new Game;
|
||||||
$game->author = $gameData->developer->display_name;
|
$game->title = $gameData->title;
|
||||||
$game->date = $gameData->published_on / 1000;
|
$game->author = $gameData->developer->display_name;
|
||||||
$game->description = $descData->payload->metaDescription;
|
$game->date = $gameData->published_on / 1000;
|
||||||
$game->url = 'https://gamejolt.com/games/'.$gameData->slug.'/'.$gameData->id;
|
$game->description = $descData->payload->metaDescription;
|
||||||
if ($game->date < $this->period) {
|
$game->url = 'https://gamejolt.com/games/'.$gameData->slug.'/'.$gameData->id;
|
||||||
continue;
|
if ($game->date < $this->period) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->output .= $game->print();
|
||||||
}
|
}
|
||||||
$this->output .= $game->print();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function parse() {
|
protected function parse() {
|
||||||
|
|
|
@ -27,13 +27,12 @@ class Steam extends Source {
|
||||||
foreach ($games as $gameLink) {
|
foreach ($games as $gameLink) {
|
||||||
$url = $gameLink->getAttribute('href');
|
$url = $gameLink->getAttribute('href');
|
||||||
$url = substr($url,0,strpos($url, '?')); // remove query string
|
$url = substr($url,0,strpos($url, '?')); // remove query string
|
||||||
game = new Game;
|
$game = new Game;
|
||||||
$game->url = $url;
|
$game->url = $url;
|
||||||
try {
|
try {
|
||||||
$text = $this->get_text($url);
|
$text = $this->get_text($url);
|
||||||
$this->dom = new Dom;
|
$this->dom = new Dom;
|
||||||
$this->dom->loadStr($text, []);
|
$this->dom->loadStr($text, []);
|
||||||
var_dump($text);
|
|
||||||
unset($text);
|
unset($text);
|
||||||
$name = $this->dom->find('div.apphub_AppName');
|
$name = $this->dom->find('div.apphub_AppName');
|
||||||
$description = $this->dom->find('meta[property=og:description]');
|
$description = $this->dom->find('meta[property=og:description]');
|
||||||
|
|
Reference in a new issue