steam parser improvements
This commit is contained in:
parent
95af2c5ec9
commit
5ab2e302f2
|
@ -2,6 +2,7 @@
|
|||
namespace Source;
|
||||
|
||||
use \Game;
|
||||
use \PHPHtmlParser\Dom;
|
||||
|
||||
class Steam extends Source {
|
||||
public $title = "Steam";
|
||||
|
@ -25,14 +26,17 @@ class Steam extends Source {
|
|||
$games = $this->dom->find('#search_result_container a.search_result_row');
|
||||
foreach ($games as $gameLink) {
|
||||
$url = $gameLink->getAttribute('href');
|
||||
$game = new Game;
|
||||
$url = substr($url,0,strpos($url, '?')); // remove query string
|
||||
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('.apphub_AppName');
|
||||
$description = $this->dom->find('.game_description_snippet');
|
||||
$name = $this->dom->find('div.apphub_AppName');
|
||||
$description = $this->dom->find('meta[property=og:description]');
|
||||
try {
|
||||
$game->title = $name->innerHtml;
|
||||
$game->description = $description->innerHtml;
|
||||
|
@ -44,6 +48,7 @@ class Steam extends Source {
|
|||
echo $e->getTraceAsString();
|
||||
}
|
||||
$this->output .= $game->print();
|
||||
die();
|
||||
}
|
||||
}
|
||||
protected function parse() {
|
||||
|
|
Reference in a new issue