47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
namespace Source;
|
|
|
|
use \Game;
|
|
|
|
class Steam extends Source {
|
|
public $title = "Steam";
|
|
protected function parse_tag($tag) {
|
|
$url = 'http://store.steampowered.com/search/';
|
|
$url .= '?'.http_build_query([
|
|
'sort_by' => 'Released_DESC',
|
|
'term' => $tag,
|
|
'displayterm' => $tag,
|
|
'category1' => 998, // only games
|
|
]);
|
|
$text = $this->get_text($url);
|
|
try {
|
|
$this->dom->loadStr($text, []);
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage();
|
|
echo $e->getTraceAsString();
|
|
return "";
|
|
}
|
|
unset($text);
|
|
$games = $this->dom->find('#search_result_container a.search_result_row');
|
|
foreach ($games as $gameLink) {
|
|
$url = $gameLink->getAttribute('href');
|
|
$text = $this->get_text($url);
|
|
$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("text-based");
|
|
}
|
|
}
|