steam WIP
This commit is contained in:
parent
d5a8f56e94
commit
b20cd53b92
|
@ -52,4 +52,33 @@ class Steam extends Source {
|
|||
protected function parse() {
|
||||
$this->parse_tag("text-based");
|
||||
}
|
||||
public function checkPage($url) {
|
||||
return (strpos($url,'http://store.steampowered.com/') !== FALSE);
|
||||
}
|
||||
public function page($url) {
|
||||
$text = $this->get_text($url);
|
||||
try {
|
||||
$this->dom->loadStr($text, []);
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
echo $e->getTraceAsString();
|
||||
return "";
|
||||
}
|
||||
unset($text);
|
||||
$game = new Game;
|
||||
$game->url = $url;
|
||||
$name = $this->dom->find('div.apphub_AppName');
|
||||
$description = $this->dom->find('meta[property=og:description]');
|
||||
try {
|
||||
$game->title = $name->innerHtml;
|
||||
$game->description = $description->innerHtml;
|
||||
} catch (\Exception $e) {
|
||||
echo 'No title or description found for '.$url.PHP_EOL;
|
||||
}
|
||||
$date = trim($gameBlock->find('.icon-calendar')->first()->text);
|
||||
$date = \DateTime::createFromFormat('d F Y', $date);
|
||||
$date = $date->format('U');
|
||||
$game->date = $date;
|
||||
return $game;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue