From bfb5143d1fbeb88b44ec3fc15f7fa9cfc251377e Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Sat, 7 Oct 2017 15:53:14 +0700 Subject: [PATCH] Steam WIP, see issue #13 --- Source/Steam.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ run.php | 2 ++ 2 files changed, 48 insertions(+) create mode 100644 Source/Steam.php diff --git a/Source/Steam.php b/Source/Steam.php new file mode 100644 index 0000000..05eb033 --- /dev/null +++ b/Source/Steam.php @@ -0,0 +1,46 @@ + '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"); + } +} diff --git a/run.php b/run.php index a650ea3..1d4587f 100755 --- a/run.php +++ b/run.php @@ -35,6 +35,7 @@ if ($parsers === 'all' || in_array('all', $parsers)) { 'dashingdon', 'itch', 'gamejolt', + 'steam', ]; } @@ -62,6 +63,7 @@ check ('IFDB', 'ifdb'); //check ('Dashingdon', 'dashingdon'); check ('Itch', 'itch'); check ('Gamejolt', 'gamejolt'); +check ('Steam', 'steam'); if (PHP_SAPI !== 'cli') { echo '';