stools-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stools_cli-0.1.0/.claude-plugin/marketplace.json +18 -0
- stools_cli-0.1.0/.github/workflows/publish.yml +25 -0
- stools_cli-0.1.0/.gitignore +3 -0
- stools_cli-0.1.0/LICENSE +21 -0
- stools_cli-0.1.0/PKG-INFO +182 -0
- stools_cli-0.1.0/README.md +163 -0
- stools_cli-0.1.0/pyproject.toml +28 -0
- stools_cli-0.1.0/skills/stools/SKILL.md +135 -0
- stools_cli-0.1.0/src/stools_cli/__init__.py +1 -0
- stools_cli-0.1.0/src/stools_cli/cli.py +244 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
|
+
"name": "stools",
|
|
4
|
+
"description": "Extract structured data from Steam (reviews, game info) as JSON",
|
|
5
|
+
"owner": {
|
|
6
|
+
"name": "aotarola"
|
|
7
|
+
},
|
|
8
|
+
"plugins": [
|
|
9
|
+
{
|
|
10
|
+
"name": "stools",
|
|
11
|
+
"description": "Fetch Steam game reviews as structured JSON for analysis, summarization, or downstream processing",
|
|
12
|
+
"source": "./",
|
|
13
|
+
"strict": false,
|
|
14
|
+
"skills": ["./skills/stools"],
|
|
15
|
+
"category": "data"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
|
|
19
|
+
- name: Build package
|
|
20
|
+
run: |
|
|
21
|
+
pip install build
|
|
22
|
+
python -m build
|
|
23
|
+
|
|
24
|
+
- name: Publish to PyPI
|
|
25
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
stools_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aotarola
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stools-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI to extract structured data from Steam (reviews, game search) — designed for LLM agents
|
|
5
|
+
Project-URL: Repository, https://github.com/aotarola/stools
|
|
6
|
+
Author: aotarola
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agent,cli,llm,reviews,steam
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Games/Entertainment
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# stools
|
|
21
|
+
|
|
22
|
+
CLI tool to extract structured data from Steam. Outputs JSON to stdout, making it easy to pipe into other tools or consume from LLM agents.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pipx install stools-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or with pip:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install stools-cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.9+. No external dependencies.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
### `stools search`
|
|
41
|
+
|
|
42
|
+
Search Steam for games by name.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
stools search <query> [--limit N] [--fields f1,f2,...]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Argument | Description |
|
|
49
|
+
|---------------|----------------------------------------------------------|
|
|
50
|
+
| `query` | Search term (e.g. `megaman`, `dark souls`) |
|
|
51
|
+
| `--limit N` | Max results to return. Default: `10` |
|
|
52
|
+
| `--fields` | Comma-separated fields to keep per result (e.g. `app_id,name`) |
|
|
53
|
+
|
|
54
|
+
#### Output schema
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"query": "megaman",
|
|
59
|
+
"total_results": 10,
|
|
60
|
+
"results": [
|
|
61
|
+
{
|
|
62
|
+
"app_id": 742300,
|
|
63
|
+
"name": "Mega Man 11",
|
|
64
|
+
"price": { "currency": "USD", "initial": 2999, "final": 2999 },
|
|
65
|
+
"platforms": { "windows": true, "mac": false, "linux": false },
|
|
66
|
+
"metascore": "80"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Examples
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Search for a game
|
|
76
|
+
stools search "megaman"
|
|
77
|
+
|
|
78
|
+
# Get top 3 results, only app_id and name
|
|
79
|
+
stools search "dark souls" --limit 3 --fields app_id,name
|
|
80
|
+
|
|
81
|
+
# Search then fetch reviews for the first result
|
|
82
|
+
APP_ID=$(stools search "snake vs snake" 2>/dev/null | jq '.results[0].app_id')
|
|
83
|
+
stools reviews "$APP_ID"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `stools reviews`
|
|
87
|
+
|
|
88
|
+
Fetch all reviews for a Steam game.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
stools reviews <app_id_or_url> [--language CODE] [--limit N] [--fields f1,f2,...] [--output FILE]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Argument | Description |
|
|
95
|
+
|----------------|-----------------------------------------------------------------------------|
|
|
96
|
+
| `app` | Steam app ID (`1005310`) or store URL (`https://store.steampowered.com/app/1005310/Snake_vs_Snake/`) |
|
|
97
|
+
| `--language` | Filter by language code: `english`, `spanish`, `french`, `german`, etc. Default: `all` |
|
|
98
|
+
| `--limit N` | Max reviews to return. `0` = all. Default: `0` |
|
|
99
|
+
| `--fields` | Comma-separated fields to keep per review (e.g. `review,voted_up`) |
|
|
100
|
+
| `--output FILE`| Write JSON to a file instead of stdout |
|
|
101
|
+
|
|
102
|
+
#### Output schema
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"app_id": 1005310,
|
|
107
|
+
"query_summary": {
|
|
108
|
+
"num_reviews": 33,
|
|
109
|
+
"review_score": 7,
|
|
110
|
+
"review_score_desc": "Positive",
|
|
111
|
+
"total_positive": 33,
|
|
112
|
+
"total_negative": 0,
|
|
113
|
+
"total_reviews": 33
|
|
114
|
+
},
|
|
115
|
+
"total_fetched": 33,
|
|
116
|
+
"reviews": [
|
|
117
|
+
{
|
|
118
|
+
"recommendationid": "210668843",
|
|
119
|
+
"author": {
|
|
120
|
+
"steamid": "76561198079866033",
|
|
121
|
+
"personaname": "username",
|
|
122
|
+
"num_reviews": 32,
|
|
123
|
+
"playtime_forever": 1554,
|
|
124
|
+
"playtime_at_review": 1554
|
|
125
|
+
},
|
|
126
|
+
"language": "english",
|
|
127
|
+
"review": "Review text here.",
|
|
128
|
+
"timestamp_created": 1764106395,
|
|
129
|
+
"timestamp_updated": 1764106395,
|
|
130
|
+
"voted_up": true,
|
|
131
|
+
"votes_up": 0,
|
|
132
|
+
"votes_funny": 0,
|
|
133
|
+
"steam_purchase": true,
|
|
134
|
+
"received_for_free": false,
|
|
135
|
+
"written_during_early_access": false
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Examples
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Fetch all reviews for a game
|
|
145
|
+
stools reviews 1005310
|
|
146
|
+
|
|
147
|
+
# Fetch only English reviews, save to file
|
|
148
|
+
stools reviews 1005310 --language english --output reviews.json
|
|
149
|
+
|
|
150
|
+
# Fetch first 10 reviews, no progress output
|
|
151
|
+
stools reviews 1005310 --limit 10
|
|
152
|
+
# Use a full Steam URL
|
|
153
|
+
stools reviews "https://store.steampowered.com/app/1005310/Snake_vs_Snake/"
|
|
154
|
+
|
|
155
|
+
# Get only review text and sentiment
|
|
156
|
+
stools reviews 1005310 --fields review,voted_up
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Exit codes
|
|
160
|
+
|
|
161
|
+
| Code | Meaning |
|
|
162
|
+
|------|--------------------|
|
|
163
|
+
| `0` | Success |
|
|
164
|
+
| `1` | Usage / input error|
|
|
165
|
+
| `2` | Network / API error|
|
|
166
|
+
|
|
167
|
+
## Agent integration
|
|
168
|
+
|
|
169
|
+
stools ships as a [Claude Code plugin](https://docs.anthropic.com/en/docs/claude-code). To use it in your agent:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
claude install-plugin aotarola/stools
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This registers the `stools` CLI as a skill that Claude Code can discover and invoke automatically. See [`skills/stools/SKILL.md`](skills/stools/SKILL.md) for the agent-facing documentation.
|
|
176
|
+
|
|
177
|
+
## Design notes
|
|
178
|
+
|
|
179
|
+
- **JSON only**: all output goes to stdout as JSON; errors go to stderr.
|
|
180
|
+
- **No dependencies**: uses only Python standard library.
|
|
181
|
+
- **Subcommand structure**: `stools <command>` — designed to grow with more Steam data commands.
|
|
182
|
+
- **Agent-ready**: includes `.claude-plugin/` manifest and `skills/` for automatic discovery by LLM agents.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# stools
|
|
2
|
+
|
|
3
|
+
CLI tool to extract structured data from Steam. Outputs JSON to stdout, making it easy to pipe into other tools or consume from LLM agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pipx install stools-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with pip:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install stools-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Python 3.9+. No external dependencies.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### `stools search`
|
|
22
|
+
|
|
23
|
+
Search Steam for games by name.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
stools search <query> [--limit N] [--fields f1,f2,...]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Argument | Description |
|
|
30
|
+
|---------------|----------------------------------------------------------|
|
|
31
|
+
| `query` | Search term (e.g. `megaman`, `dark souls`) |
|
|
32
|
+
| `--limit N` | Max results to return. Default: `10` |
|
|
33
|
+
| `--fields` | Comma-separated fields to keep per result (e.g. `app_id,name`) |
|
|
34
|
+
|
|
35
|
+
#### Output schema
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"query": "megaman",
|
|
40
|
+
"total_results": 10,
|
|
41
|
+
"results": [
|
|
42
|
+
{
|
|
43
|
+
"app_id": 742300,
|
|
44
|
+
"name": "Mega Man 11",
|
|
45
|
+
"price": { "currency": "USD", "initial": 2999, "final": 2999 },
|
|
46
|
+
"platforms": { "windows": true, "mac": false, "linux": false },
|
|
47
|
+
"metascore": "80"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Examples
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Search for a game
|
|
57
|
+
stools search "megaman"
|
|
58
|
+
|
|
59
|
+
# Get top 3 results, only app_id and name
|
|
60
|
+
stools search "dark souls" --limit 3 --fields app_id,name
|
|
61
|
+
|
|
62
|
+
# Search then fetch reviews for the first result
|
|
63
|
+
APP_ID=$(stools search "snake vs snake" 2>/dev/null | jq '.results[0].app_id')
|
|
64
|
+
stools reviews "$APP_ID"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `stools reviews`
|
|
68
|
+
|
|
69
|
+
Fetch all reviews for a Steam game.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
stools reviews <app_id_or_url> [--language CODE] [--limit N] [--fields f1,f2,...] [--output FILE]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Argument | Description |
|
|
76
|
+
|----------------|-----------------------------------------------------------------------------|
|
|
77
|
+
| `app` | Steam app ID (`1005310`) or store URL (`https://store.steampowered.com/app/1005310/Snake_vs_Snake/`) |
|
|
78
|
+
| `--language` | Filter by language code: `english`, `spanish`, `french`, `german`, etc. Default: `all` |
|
|
79
|
+
| `--limit N` | Max reviews to return. `0` = all. Default: `0` |
|
|
80
|
+
| `--fields` | Comma-separated fields to keep per review (e.g. `review,voted_up`) |
|
|
81
|
+
| `--output FILE`| Write JSON to a file instead of stdout |
|
|
82
|
+
|
|
83
|
+
#### Output schema
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"app_id": 1005310,
|
|
88
|
+
"query_summary": {
|
|
89
|
+
"num_reviews": 33,
|
|
90
|
+
"review_score": 7,
|
|
91
|
+
"review_score_desc": "Positive",
|
|
92
|
+
"total_positive": 33,
|
|
93
|
+
"total_negative": 0,
|
|
94
|
+
"total_reviews": 33
|
|
95
|
+
},
|
|
96
|
+
"total_fetched": 33,
|
|
97
|
+
"reviews": [
|
|
98
|
+
{
|
|
99
|
+
"recommendationid": "210668843",
|
|
100
|
+
"author": {
|
|
101
|
+
"steamid": "76561198079866033",
|
|
102
|
+
"personaname": "username",
|
|
103
|
+
"num_reviews": 32,
|
|
104
|
+
"playtime_forever": 1554,
|
|
105
|
+
"playtime_at_review": 1554
|
|
106
|
+
},
|
|
107
|
+
"language": "english",
|
|
108
|
+
"review": "Review text here.",
|
|
109
|
+
"timestamp_created": 1764106395,
|
|
110
|
+
"timestamp_updated": 1764106395,
|
|
111
|
+
"voted_up": true,
|
|
112
|
+
"votes_up": 0,
|
|
113
|
+
"votes_funny": 0,
|
|
114
|
+
"steam_purchase": true,
|
|
115
|
+
"received_for_free": false,
|
|
116
|
+
"written_during_early_access": false
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Examples
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Fetch all reviews for a game
|
|
126
|
+
stools reviews 1005310
|
|
127
|
+
|
|
128
|
+
# Fetch only English reviews, save to file
|
|
129
|
+
stools reviews 1005310 --language english --output reviews.json
|
|
130
|
+
|
|
131
|
+
# Fetch first 10 reviews, no progress output
|
|
132
|
+
stools reviews 1005310 --limit 10
|
|
133
|
+
# Use a full Steam URL
|
|
134
|
+
stools reviews "https://store.steampowered.com/app/1005310/Snake_vs_Snake/"
|
|
135
|
+
|
|
136
|
+
# Get only review text and sentiment
|
|
137
|
+
stools reviews 1005310 --fields review,voted_up
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Exit codes
|
|
141
|
+
|
|
142
|
+
| Code | Meaning |
|
|
143
|
+
|------|--------------------|
|
|
144
|
+
| `0` | Success |
|
|
145
|
+
| `1` | Usage / input error|
|
|
146
|
+
| `2` | Network / API error|
|
|
147
|
+
|
|
148
|
+
## Agent integration
|
|
149
|
+
|
|
150
|
+
stools ships as a [Claude Code plugin](https://docs.anthropic.com/en/docs/claude-code). To use it in your agent:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
claude install-plugin aotarola/stools
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
This registers the `stools` CLI as a skill that Claude Code can discover and invoke automatically. See [`skills/stools/SKILL.md`](skills/stools/SKILL.md) for the agent-facing documentation.
|
|
157
|
+
|
|
158
|
+
## Design notes
|
|
159
|
+
|
|
160
|
+
- **JSON only**: all output goes to stdout as JSON; errors go to stderr.
|
|
161
|
+
- **No dependencies**: uses only Python standard library.
|
|
162
|
+
- **Subcommand structure**: `stools <command>` — designed to grow with more Steam data commands.
|
|
163
|
+
- **Agent-ready**: includes `.claude-plugin/` manifest and `skills/` for automatic discovery by LLM agents.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stools-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI to extract structured data from Steam (reviews, game search) — designed for LLM agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [{ name = "aotarola" }]
|
|
13
|
+
keywords = ["steam", "cli", "reviews", "llm", "agent"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Topic :: Games/Entertainment",
|
|
21
|
+
"Topic :: Utilities",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
stools = "stools_cli.cli:main"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Repository = "https://github.com/aotarola/stools"
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# stools — Steam data extraction CLI
|
|
2
|
+
|
|
3
|
+
You have access to `stools`, a CLI that fetches structured data from Steam. All output is JSON on stdout. Errors go to stderr.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
Python 3.9+. No external dependencies.
|
|
8
|
+
|
|
9
|
+
## Typical Workflow
|
|
10
|
+
|
|
11
|
+
When a user asks about a Steam game by name (not by app ID or URL):
|
|
12
|
+
|
|
13
|
+
1. Run `stools search "<game name>" --fields app_id,name` to find matching games.
|
|
14
|
+
2. If multiple results match, present the options to the user and ask which one they mean.
|
|
15
|
+
3. Use the `app_id` from the chosen result to run `stools reviews <app_id>`.
|
|
16
|
+
|
|
17
|
+
When the user provides a Steam URL or app ID directly, skip to step 3.
|
|
18
|
+
|
|
19
|
+
Use `--fields` on both commands to request only the data you need and keep context small.
|
|
20
|
+
|
|
21
|
+
## Available Commands
|
|
22
|
+
|
|
23
|
+
### `stools search`
|
|
24
|
+
|
|
25
|
+
Search Steam for games by name.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
stools search <query> [--limit N] [--fields f1,f2,...]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Arguments:**
|
|
32
|
+
|
|
33
|
+
- `query` (required): Search term (e.g. `"megaman"`, `"dark souls"`, `"snake"`)
|
|
34
|
+
- `--limit N`: Max results to return. Default: `10`
|
|
35
|
+
- `--fields f1,f2,...`: Comma-separated fields to keep per result. Available: `app_id`, `name`, `price`, `platforms`, `metascore`
|
|
36
|
+
|
|
37
|
+
**Output:**
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"query": "megaman",
|
|
42
|
+
"total_results": 10,
|
|
43
|
+
"results": [
|
|
44
|
+
{
|
|
45
|
+
"app_id": 742300,
|
|
46
|
+
"name": "Mega Man 11"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Key fields:**
|
|
53
|
+
|
|
54
|
+
- `results[].app_id`: Use this to call `stools reviews`
|
|
55
|
+
- `results[].name`: Display name to show the user
|
|
56
|
+
- `results[].price.final`: Price in cents (divide by 100 for dollars)
|
|
57
|
+
|
|
58
|
+
### `stools reviews`
|
|
59
|
+
|
|
60
|
+
Fetch all reviews for a Steam game.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
stools reviews <app_id_or_url> [--language CODE] [--limit N] [--fields f1,f2,...] [--output FILE]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Arguments:**
|
|
67
|
+
|
|
68
|
+
- `app` (required): Steam app ID (e.g. `1005310`) or full store URL
|
|
69
|
+
- `--language CODE`: Filter by language — `english`, `spanish`, `french`, `german`, etc. Default: `all`
|
|
70
|
+
- `--limit N`: Max reviews to return. `0` = all. Default: `0`
|
|
71
|
+
- `--fields f1,f2,...`: Comma-separated fields to keep per review. Available: `recommendationid`, `author`, `language`, `review`, `timestamp_created`, `timestamp_updated`, `voted_up`, `votes_up`, `votes_funny`, `steam_purchase`, `received_for_free`, `written_during_early_access`
|
|
72
|
+
- `--output FILE`: Write JSON to a file instead of stdout
|
|
73
|
+
|
|
74
|
+
**Output:**
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"app_id": 1005310,
|
|
79
|
+
"query_summary": {
|
|
80
|
+
"num_reviews": 33,
|
|
81
|
+
"review_score": 7,
|
|
82
|
+
"review_score_desc": "Positive",
|
|
83
|
+
"total_positive": 33,
|
|
84
|
+
"total_negative": 0,
|
|
85
|
+
"total_reviews": 33
|
|
86
|
+
},
|
|
87
|
+
"total_fetched": 33,
|
|
88
|
+
"reviews": [
|
|
89
|
+
{
|
|
90
|
+
"review": "The review text content.",
|
|
91
|
+
"voted_up": true
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Key fields:**
|
|
98
|
+
|
|
99
|
+
- `query_summary.review_score_desc`: Overall rating label (e.g. "Positive", "Mixed", "Overwhelmingly Positive")
|
|
100
|
+
- `query_summary.total_positive` / `total_negative`: Vote counts
|
|
101
|
+
- `reviews[].voted_up`: `true` = positive, `false` = negative
|
|
102
|
+
- `reviews[].review`: The full review text
|
|
103
|
+
- `reviews[].playtime_forever`: Total playtime in minutes
|
|
104
|
+
- `reviews[].playtime_at_review`: Playtime at time of review in minutes
|
|
105
|
+
|
|
106
|
+
## Exit Codes
|
|
107
|
+
|
|
108
|
+
`0` = success, `1` = input error, `2` = network/API error.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Search for a game (minimal output)
|
|
114
|
+
stools search "snake vs snake" --fields app_id,name
|
|
115
|
+
|
|
116
|
+
# Fetch reviews — just text and sentiment
|
|
117
|
+
stools reviews 1005310 --fields review,voted_up
|
|
118
|
+
|
|
119
|
+
# Get only English reviews
|
|
120
|
+
stools reviews 1005310 --language english --fields review,voted_up
|
|
121
|
+
|
|
122
|
+
# Get a sample of 10 reviews
|
|
123
|
+
stools reviews 1005310 --limit 10 --fields review,voted_up
|
|
124
|
+
|
|
125
|
+
# Save full reviews to file
|
|
126
|
+
stools reviews 1005310 --output reviews.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Tips
|
|
130
|
+
|
|
131
|
+
- Use `--fields` to reduce output size. For disambiguation, `--fields app_id,name` is usually enough.
|
|
132
|
+
- Use `--limit` to fetch a small sample before pulling all reviews for large games.
|
|
133
|
+
- The `reviews` command accepts full Steam URLs, so you can pass URLs directly from the user.
|
|
134
|
+
- Timestamps are Unix epoch seconds.
|
|
135
|
+
- Prices are in cents (e.g. `2999` = $29.99).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""stools — CLI to extract structured data from Steam."""
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"""stools — CLI to extract structured data from Steam.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
stools search <query> [--limit <n>]
|
|
5
|
+
stools reviews <app_id_or_url> [--language <code>] [--limit <n>] [--output <file>]
|
|
6
|
+
|
|
7
|
+
All output is JSON on stdout. Errors go to stderr.
|
|
8
|
+
Exit codes: 0 = success, 1 = usage error, 2 = network/API error.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import re
|
|
14
|
+
import sys
|
|
15
|
+
import time
|
|
16
|
+
import urllib.error
|
|
17
|
+
import urllib.parse
|
|
18
|
+
import urllib.request
|
|
19
|
+
|
|
20
|
+
VERSION = "0.1.0"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def pick_fields(items: list[dict], fields: list[str]) -> list[dict]:
|
|
24
|
+
"""Keep only the specified keys from each dict in a list."""
|
|
25
|
+
picked = []
|
|
26
|
+
for item in items:
|
|
27
|
+
picked.append({k: item[k] for k in fields if k in item})
|
|
28
|
+
return picked
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def parse_app_id(value: str) -> int:
|
|
32
|
+
"""Extract a Steam app ID from a store URL or plain integer string."""
|
|
33
|
+
match = re.search(r"store\.steampowered\.com/app/(\d+)", value)
|
|
34
|
+
if match:
|
|
35
|
+
return int(match.group(1))
|
|
36
|
+
if value.isdigit():
|
|
37
|
+
return int(value)
|
|
38
|
+
print(
|
|
39
|
+
json.dumps({"error": f"Cannot parse app ID from '{value}'. Provide a Steam store URL or numeric app ID."}),
|
|
40
|
+
file=sys.stderr,
|
|
41
|
+
)
|
|
42
|
+
sys.exit(1)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def fetch_reviews(app_id: int, language: str = "all", limit: int = 0) -> dict:
|
|
46
|
+
"""Fetch reviews for a Steam app, paginating automatically."""
|
|
47
|
+
all_reviews: list[dict] = []
|
|
48
|
+
cursor = "*"
|
|
49
|
+
query_summary = None
|
|
50
|
+
per_page = 100
|
|
51
|
+
|
|
52
|
+
while True:
|
|
53
|
+
if limit and len(all_reviews) >= limit:
|
|
54
|
+
break
|
|
55
|
+
|
|
56
|
+
batch_size = min(per_page, limit - len(all_reviews)) if limit else per_page
|
|
57
|
+
|
|
58
|
+
params = urllib.parse.urlencode({
|
|
59
|
+
"json": 1,
|
|
60
|
+
"num_per_page": batch_size,
|
|
61
|
+
"cursor": cursor,
|
|
62
|
+
"filter": "recent",
|
|
63
|
+
"language": language,
|
|
64
|
+
"review_type": "all",
|
|
65
|
+
"purchase_type": "all",
|
|
66
|
+
})
|
|
67
|
+
url = f"https://store.steampowered.com/appreviews/{app_id}?{params}"
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
req = urllib.request.Request(url, headers={"User-Agent": "stools/0.1.0"})
|
|
71
|
+
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
72
|
+
data = json.loads(resp.read().decode())
|
|
73
|
+
except urllib.error.URLError as e:
|
|
74
|
+
print(json.dumps({"error": f"Network error: {e}"}), file=sys.stderr)
|
|
75
|
+
sys.exit(2)
|
|
76
|
+
|
|
77
|
+
if data.get("success") != 1:
|
|
78
|
+
print(json.dumps({"error": "Steam API error. Verify the app ID exists."}), file=sys.stderr)
|
|
79
|
+
sys.exit(2)
|
|
80
|
+
|
|
81
|
+
if query_summary is None:
|
|
82
|
+
query_summary = data.get("query_summary", {})
|
|
83
|
+
|
|
84
|
+
reviews = data.get("reviews", [])
|
|
85
|
+
if not reviews:
|
|
86
|
+
break
|
|
87
|
+
|
|
88
|
+
all_reviews.extend(reviews)
|
|
89
|
+
|
|
90
|
+
cursor = data.get("cursor")
|
|
91
|
+
if not cursor:
|
|
92
|
+
break
|
|
93
|
+
|
|
94
|
+
time.sleep(0.5)
|
|
95
|
+
|
|
96
|
+
if limit:
|
|
97
|
+
all_reviews = all_reviews[:limit]
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
"app_id": app_id,
|
|
101
|
+
"query_summary": query_summary,
|
|
102
|
+
"total_fetched": len(all_reviews),
|
|
103
|
+
"reviews": all_reviews,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def fetch_search(query: str, limit: int = 10) -> dict:
|
|
108
|
+
"""Search Steam for games matching a query."""
|
|
109
|
+
params = urllib.parse.urlencode({
|
|
110
|
+
"term": query,
|
|
111
|
+
"l": "english",
|
|
112
|
+
"cc": "US",
|
|
113
|
+
})
|
|
114
|
+
url = f"https://store.steampowered.com/api/storesearch/?{params}"
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
req = urllib.request.Request(url, headers={"User-Agent": "stools/0.1.0"})
|
|
118
|
+
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
119
|
+
data = json.loads(resp.read().decode())
|
|
120
|
+
except urllib.error.URLError as e:
|
|
121
|
+
print(json.dumps({"error": f"Network error: {e}"}), file=sys.stderr)
|
|
122
|
+
sys.exit(2)
|
|
123
|
+
|
|
124
|
+
items = data.get("items", [])[:limit]
|
|
125
|
+
|
|
126
|
+
results = []
|
|
127
|
+
for item in items:
|
|
128
|
+
results.append({
|
|
129
|
+
"app_id": item["id"],
|
|
130
|
+
"name": item["name"],
|
|
131
|
+
"price": item.get("price"),
|
|
132
|
+
"platforms": item.get("platforms"),
|
|
133
|
+
"metascore": item.get("metascore") or None,
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
"query": query,
|
|
138
|
+
"total_results": data.get("total", 0),
|
|
139
|
+
"results": results,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def cmd_search(args: argparse.Namespace) -> None:
|
|
144
|
+
result = fetch_search(args.query, limit=args.limit)
|
|
145
|
+
if args.fields:
|
|
146
|
+
result["results"] = pick_fields(result["results"], args.fields)
|
|
147
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def cmd_reviews(args: argparse.Namespace) -> None:
|
|
151
|
+
app_id = parse_app_id(args.app)
|
|
152
|
+
result = fetch_reviews(app_id, language=args.language, limit=args.limit)
|
|
153
|
+
if args.fields:
|
|
154
|
+
result["reviews"] = pick_fields(result["reviews"], args.fields)
|
|
155
|
+
|
|
156
|
+
output = json.dumps(result, indent=2, ensure_ascii=False)
|
|
157
|
+
if args.output:
|
|
158
|
+
with open(args.output, "w", encoding="utf-8") as f:
|
|
159
|
+
f.write(output + "\n")
|
|
160
|
+
else:
|
|
161
|
+
print(output)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def main() -> None:
|
|
165
|
+
parser = argparse.ArgumentParser(
|
|
166
|
+
prog="stools",
|
|
167
|
+
description="CLI to extract structured data from Steam. All output is JSON.",
|
|
168
|
+
)
|
|
169
|
+
parser.add_argument("--version", action="version", version=f"stools {VERSION}")
|
|
170
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
171
|
+
|
|
172
|
+
# --- search subcommand ---
|
|
173
|
+
search_parser = subparsers.add_parser(
|
|
174
|
+
"search",
|
|
175
|
+
help="Search Steam for games matching a query.",
|
|
176
|
+
description=(
|
|
177
|
+
"Search for games on Steam by name. Returns a JSON object with fields: "
|
|
178
|
+
"query, total_results, results. Each result has: app_id, name, price, platforms, metascore."
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
search_parser.add_argument(
|
|
182
|
+
"query",
|
|
183
|
+
help="Search term (e.g. 'megaman', 'dark souls', 'snake')",
|
|
184
|
+
)
|
|
185
|
+
search_parser.add_argument(
|
|
186
|
+
"--limit",
|
|
187
|
+
type=int,
|
|
188
|
+
default=10,
|
|
189
|
+
metavar="N",
|
|
190
|
+
help="Max results to return (default: 10)",
|
|
191
|
+
)
|
|
192
|
+
search_parser.add_argument(
|
|
193
|
+
"--fields",
|
|
194
|
+
type=lambda s: s.split(","),
|
|
195
|
+
metavar="f1,f2,...",
|
|
196
|
+
help="Comma-separated list of fields to keep per result. Available: app_id, name, price, platforms, metascore",
|
|
197
|
+
)
|
|
198
|
+
search_parser.set_defaults(func=cmd_search)
|
|
199
|
+
|
|
200
|
+
# --- reviews subcommand ---
|
|
201
|
+
reviews_parser = subparsers.add_parser(
|
|
202
|
+
"reviews",
|
|
203
|
+
help="Fetch all reviews for a Steam game as JSON.",
|
|
204
|
+
description=(
|
|
205
|
+
"Fetch reviews for a Steam game. Accepts a numeric app ID or a full Steam store URL. "
|
|
206
|
+
"Output is a JSON object with fields: app_id, query_summary, total_fetched, reviews."
|
|
207
|
+
),
|
|
208
|
+
)
|
|
209
|
+
reviews_parser.add_argument(
|
|
210
|
+
"app",
|
|
211
|
+
help="Steam app ID (e.g. 1005310) or store URL (e.g. https://store.steampowered.com/app/1005310/Snake_vs_Snake/)",
|
|
212
|
+
)
|
|
213
|
+
reviews_parser.add_argument(
|
|
214
|
+
"--language",
|
|
215
|
+
default="all",
|
|
216
|
+
metavar="CODE",
|
|
217
|
+
help="Filter by language: english, spanish, french, german, etc. (default: all)",
|
|
218
|
+
)
|
|
219
|
+
reviews_parser.add_argument(
|
|
220
|
+
"--limit",
|
|
221
|
+
type=int,
|
|
222
|
+
default=0,
|
|
223
|
+
metavar="N",
|
|
224
|
+
help="Max number of reviews to fetch. 0 = all (default: 0)",
|
|
225
|
+
)
|
|
226
|
+
reviews_parser.add_argument(
|
|
227
|
+
"--output",
|
|
228
|
+
metavar="FILE",
|
|
229
|
+
help="Write JSON to FILE instead of stdout.",
|
|
230
|
+
)
|
|
231
|
+
reviews_parser.add_argument(
|
|
232
|
+
"--fields",
|
|
233
|
+
type=lambda s: s.split(","),
|
|
234
|
+
metavar="f1,f2,...",
|
|
235
|
+
help="Comma-separated list of fields to keep per review. Available: recommendationid, author, language, review, timestamp_created, timestamp_updated, voted_up, votes_up, votes_funny, steam_purchase, received_for_free, written_during_early_access",
|
|
236
|
+
)
|
|
237
|
+
reviews_parser.set_defaults(func=cmd_reviews)
|
|
238
|
+
|
|
239
|
+
args = parser.parse_args()
|
|
240
|
+
args.func(args)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
if __name__ == "__main__":
|
|
244
|
+
main()
|