Ankomm
Ankomm

Reputation: 563

Steam API all games

I've been reading forums and trying Steam APIs, I'm searching for an API which provides all Steam Games.

I found the API providing all SteamApps, and the Steam Store API which provides information for Apps (I'm looking for the type: 'game'), but for this, I need to call the store API once for each SteamApp... And the Store API is limited to 200 calls every 5 minutes! Is it the only solution?

EDIT:

All Apps API : http://api.steampowered.com/ISteamApps/GetAppList/v0002/?key=STEAMKEY&format=json

App details API : http://store.steampowered.com/api/appdetails?appids={APP_ID}

Upvotes: 36

Views: 59649

Answers (4)

Epoc
Epoc

Reputation: 7496

There's the IStoreService/GetAppList endpoint of the Steam Web API which gives information similar to ISteamApps/GetAppList, but at least it's filterable, e.g. to get all games only:

https://api.steampowered.com/IStoreService/GetAppList/v1/?key={your api key}&include_games=true&include_dlc=false&include_software=false&include_videos=false&include_hardware=false

Note: you'll probably need to paginate results as there's a maximum of 50k items per page.

Upvotes: 1

Gzim Hasani
Gzim Hasani

Reputation: 21

I created a small script that might be helpful. It allows you to get all the games you own, along with some sorting.

https://github.com/ghasani/steam_sorter/blob/main/steam_sorter.py

import requests
import pandas as pd

USER_API_KEY = 'INSERT STEAM API KEY'
USER_STEAM_ID = 'INSERT STEAM ID'

api = 'https://api.steampowered.com/ISteamApps/GetAppList/v2/'
res = requests.get(url=api)
dict = res.json()['applist']['apps']
data_clean = {}
for game in dict:
    data_clean[game['appid']] = game['name']

def get_name(id):
    return data_clean[id]

def get_score(id):
    data = requests.get(f'https://store.steampowered.com/appreviews/{id}?json=1').json()['query_summary']
    score = data['total_positive']/data['total_reviews']
    return score

user_url = f'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key={USER_API_KEY}&steamid={USER_STEAM_ID}&format=json'
user_game_data = requests.get(url=user_url).json()

games_owned_id = []
for result in user_game_data['response']['games']:
    games_owned_id.append(result['appid'])

my_games_and_user_scores = {}
for game_id in games_owned_id:
    try:
        my_games_and_user_scores[get_name(game_id)] = get_score(game_id)
    except:
        pass

df = pd.DataFrame(my_games_and_user_scores.items(), columns=('Game', 'User Score'))
df.sort_values(by=('User Score'), inplace=True, ascending=False, ignore_index=True)

df.to_csv('~/Desktop/mygames.csv')

Upvotes: 1

EliteRaceElephant
EliteRaceElephant

Reputation: 8162

There is no "Steam API all games and all their details in one go".

You use GetAppList to get all the steam apps. Then you have to query each app with appdetails which will take a long time.

{
  "applist": {
    "apps": [
      {"appid": 10, "name": "Counter-Strike"},
      {"appid": 20, "name": "Team Fortress Classic"},
      {"appid": 30, "name": "Day of Defeat"},
      {"appid": 40, "name": "Deathmatch Classic"}
    ]
  }
}
{
  "10": {
    "success": true, 
    "data": {
      "type": "game",
      "name": "Counter-Strike",
      "steam_appid": 10,
      "required_age": 0,
      "is_free": false,
      "detailed_description": "...",
      "about_the_game": "...",
      "short_description": "...",
      "developers": ["Valve"],
      "publishers": ["Valve"],
      "EVEN_MORE_DATA": {}
    }
  }
}

There is a general API rate limit for each unique IP adress of 200 requests in five minutes which is one request every 1.5 seconds.

Another solution would be to use a third-party service such as SteamApis which offers more options but they are inevitably bound to what Steam offers in their API.

Upvotes: 13

Angry 84
Angry 84

Reputation: 2995

A common method here is to cache the results.

So for example, if your using something like PHP to query the results, you would do something like json_encode and json_decode with an array / object to hold the last results.

You can get fancy depending on what you want, but basically you'll need to cache and then perform an update of the oldest.

Upvotes: 6

Related Questions