Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Steam API get historical player count of specific game

I am using steam api with python in order to get the number of players playing a game such as Dota 2.

import requests
import numpy as np
import pandas as pd

def main():

    header = {"Client-ID": "F07D7ED5C43A695B3EBB01C28B6A18E5"}

    appId = 570
    game_players_url = 'https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?format=json&appid=' + appId
    game_players = requests.get(game_players_url, headers=header)

    print("Game name: Dota 2" + ", Player count: " + str(game_players.json()['response']['player_count']))


if __name__ == '__main__':
    main()

This gets me the correct current number of players for a specific game (in this case dota 2), however what i need is historical data concerning the player count of this specific game. This should be possible, since this site has the information that i desire and they are probably getting their data from the Steam API.

Any help would be greatly appreciated!

Thank you

like image 974
codastic Avatar asked Aug 31 '17 14:08

codastic


People also ask

How do I query Steam API?

The public Steamworks Web API is accessed by making HTTP (port 80) or HTTPS (port 443) requests to api.steampowered.com . If you're a publisher, then Steam also provides a partner-only Web API server hosted at https://partner.steam-api.com .

How do I get my Steamworks API key?

The standard user keys are available to everyone, all that is required is a Steam account and the domain name that will be associated with this key. You will also need to agree to the Steam Web API Terms of Use. You can create a user Web API key from the registration page on the Steam Community.


1 Answers

ilhicas pointed it out correctly in the comments: SteamDB has this historical data because they have been collecting and saving it for years, every single day. Official release for SteamDB was around 2010 so that's why they have so much data.

I have had a similar problem, looked around extensiveley and came to this conclusion:

There is no Steam Web API method for historical player count of a specific game.

In case you do not believe me:

  • Valve's official Web API reference: https://partner.steamgames.com/doc/webapi_overview
  • An unofficial reference from the SteamDB creators: https://lab.xpaw.me/steam_api_documentation.html
like image 64
EliteRaceElephant Avatar answered Sep 19 '22 03:09

EliteRaceElephant