Reputation: 29
So i'm trying to start a steamgame by entering the name of the game. For this reason I asked myself if it is possible to figure out the steam AppID through the entered name.
So I tried to collect the IDs through my steamApps folder without success. I also found a website where you could search for the name of a specific game.
For example "https://www.steamgriddb.com/api/v2/search/autocomplete/grandtheftautov" returns a json with gtaIV and gtaV
The Problem with that is, that the stamAppID isn't found in the retrieved data.
Also I found an SQL Database (https://steam.internet.byu.edu/) where the steam name and the appID are found. But this wouldn't be my prefered way to go, because the database is 17gb big.
Upvotes: 2
Views: 10384
Reputation: 489
If you save this into a file called playercount.sh and run it from a Linux terminal, you can accomplish exactly this.
#!/bin/bash
#Example Usage: ./playercount.sh "Left 4 Dead 2"
appid=$(curl -s https://api.steampowered.com/ISteamApps/GetAppList/v0002/ | jq ".applist.apps[] | select(.name==\"$1\")" | jq '.appid')
curl -s https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid="$appid" | jq '.response.player_count'
Upvotes: 0
Reputation: 8162
You use this API call: https://api.steampowered.com/ISteamApps/GetAppList/v2/
{
"applist": {
"apps": [
{
"appid": 946180,
"name": "The Gardens Between Soundtrack"
},
{
"appid": 946190,
"name": "Loveless cat"
},
...
More info here. The list is huge. Open it with a editor that can handle a huge file. You can search the JSON by name.
Upvotes: 4