How can I get a list of the App IDs of all games in my library?

I have over 1100 games and am saving them all locally, and want associated data for the games so I can easily transfer games from PC to PC on my home network, but the game ID is needed, and I'm not really up to the task of finding them all manually. I found this script that downloads all header images for the games I own on Steam, but is there a way to get an overview of all App IDs of all of the games in my Steam library?

38.1k 48 48 gold badges 182 182 silver badges 308 308 bronze badges asked Mar 7, 2020 at 14:24 201 2 2 silver badges 4 4 bronze badges

Hi HTWingNut, welcome to Arqade! I've added the original script link back - now that the question no longer asks for a recommendation for an external script, I don't think it's removal is warranted - it made the answers that addressed the script confusing without it. Hope that helps :)

Commented Mar 9, 2020 at 6:18

4 Answers 4

The script you've linked gets your entire Steam library as XML. The ID you're looking for is included in the XML.

The script retrieves your library from the following link:

http://steamcommunity.com/id//games?tab=all&xml=1 

where is your profile ID. To find your profile ID, go to your profile page on Steam, click on "Edit Profile", and the ID will be the number in the "Custom URL" section. Alternatively, you can log in to Steam in your browser, go to your profile page, and get the ID from the URL in your browser's address bar.

The XML contains a steamID (your profile name), a steamID64 (a unique number), and a list of your games.

Here's an example of a game I own:

 220      /stats/HL2 ]]>    

Which means that I own a game called "Half-Life 2", whose ID is 220.

Now all we need to do is write the function that'll give us a list of game IDs.

NOTE: The script you've linked is written in Python 2, but I use Python 3. If you have to use Python 2, you'll need to do the conversion yourself, which shouldn't be too hard to do.

def get_ids(username): tree = ET.parse(get_steam_xml(username)) root = tree.getroot() if root.find('error') is not None: print(root.find('error').text) sys.exit(0) return

Or if you want a full standalone script:

import os import sys import urllib.request import xml.etree.ElementTree as ET def get_steam_xml(username): xml_url = 'http://steamcommunity.com/id/<>/games?tab=all&xml=1'.format( username) return urllib.request.urlopen(xml_url) def get_ids(username): tree = ET.parse(get_steam_xml(username)) root = tree.getroot() if root.find('error') is not None: print(root.find('error').text) sys.exit(0) return def main(): username = input('Steam username: ') path_to_save = input( 'Path to save (leave blank for current directory): ') if path_to_save == '': path_to_save = '.' else: path_to_save = path_to_save.replace('\\', '/') if path_to_save[-1:] == '/': path_to_save = path_to_save[:-1] if not os.path.isdir(path_to_save): print('Directory does not exist') sys.exit(0) with open(path_to_save + '/ids.txt', 'w', encoding='utf-8') as f: for id, name in get_ids(username).items(): f.write("<>,<>\n".format(id, name)) if __name__ == '__main__': main() 

This creates a "ids.txt" file where each line is in the format: id,name . Note that a game's name can contain commas. If you need the file in a different format, you'll need to modify the script yourself.