This topic has been locked
Adam Beckett Feb 27, 2024 @ 10:01am
Export player Steam Collection as XML/JSON file?
Could not find anything in Steam Dev API docs, nor googlebing search (except someone else asking the same question 7 years ago, here)?

If anyone knows how or where to look at (Steam client must write the file locally, after all), I'd appreciate it.

Otherwise - if you do not know - please, ignore this post, so it won't pop noisy 'notifications' for no real reason. Click on something else instead?

Thank you.

:47_thumb_up:
< >
Showing 1-15 of 15 comments
MalikQayum Feb 27, 2024 @ 3:38pm 
do you mean the steam library collections as in the collection they are sorted in "free 2 play" etc.

or do you mean an entire list of games the user owns?

also could you link to that 7 year old question maybe that will provide better context to as what you want to achieve.
Cat on Linux Feb 27, 2024 @ 4:03pm 
there's no such functionality in steam client because it doesn't need it. if you need xml or json for whatever reason nothing prevents you from making one by yourself (if you know the syntax and basic programming). you can find your games in steam folder in one of vdf files, will need to write (or find) parser to make it into json.

or you can go from web view with list of your games and use javascript or php parser to grab your games
for example js workaround
https://steamcommunity.com/discussions/forum/0/1745643248320082993/
Adam Beckett Feb 27, 2024 @ 5:42pm 
Originally posted by Cat on Linux:
snip

... thanks, for trying to help.


I wanted a readable text version of my custom collection categories - not 'just' a list of my owned games. Which - as you wrote - is rather easy to get.

I dug a bit more into the Steam client folder and files and really could not find the 'collection' categories saved client-side (also checking the compiled/binary files).


With almost 3000 games in my library - and having done the footwork to sort them manually, in the client - I was hoping to view them as a list, sorted, in my categories, without having to be on a Steam Desktop Client installed PC.

I have my games listed into categories reflecting the installed size on drive. Something the Steam client only allows as a filter for installed games. Putting the games into collection-categories allows to view them by install-size, without having them installed):

List of Games below 100MB
List of Games below 500MB
List of Games below 1GB
etc
etc

Viewing the list of owned games without having to load the client or be on a 'Gaming PC' was my goal. Steam Mobile also does not have this 'functionality', of course.

I guess, I have to come up with something that is preferably not just taking 100+ screenshots of the opened Steam client library.
Last edited by Adam Beckett; Feb 28, 2024 @ 4:04am
ペンギン Feb 27, 2024 @ 6:17pm 
Originally posted by Adam Beckett:
...
Good question, I personally am not aware of anything in this regard. However, reading out your own products as a list is easy to realise via SteamAPI access. Whether PHP/Curl or Python to XML/JSON/TXT or whatever.... It would be more promising to look in that direction
Last edited by ペンギン; Feb 27, 2024 @ 6:45pm
metamec Feb 28, 2024 @ 8:57am 
All the assets (games, dlc, etc.) linked to your account are stored in appcache/appinfo.vdf (by default: C:\Program Files (x86)\Steam\appcache\appinfo.vdf).

The problem: It is binary and not trivial to parse. If you're into coding, there are some projects at Github which give an idea, but for me it was too much hassle.

I ended up writing a Powershell script to convert the game list at https://steamcommunity.com/id/[username]/games?xml=1 to JSON.

No idea if it's what you're looking for, but feel free to use it. Make sure the profileUrl variable is your own. Delete the XML file when you buy new games because it will always use the downloaded copy if it exists. I only selected the appID, name, hoursLast2Weeks and hoursOnRecord datapoints to transfer from XML to JSON but you can add others if you want.

# Define your Steam profile URL $profileUrl = "https://steamcommunity.com/id/[username]" $xmlFileName = "games.xml" $jsonFileName = "games.json" $scriptDirectory = $PSScriptRoot $xmlUrl = "$profileUrl/games?xml=1" $xmlFilePath = Join-Path -Path $scriptDirectory -ChildPath $xmlFileName # Check if the XML file already exists if (-not (Test-Path $xmlFilePath)) { # If the file doesn't exist, download it Invoke-WebRequest -Uri $xmlUrl -OutFile $xmlFilePath Write-Host "XML file downloaded successfully." } else { Write-Host "XML file already exists. Skipping download." } $xmlContent = [xml](Get-Content -Path $xmlFilePath) $games = @() # Loop through each <game> node in the XML and choose which datapoints you want in your JSON file foreach ($gameNode in $xmlContent.gamesList.games.game) { $game = [PSCustomObject]@{ appID = $gameNode.appID name = $gameNode.name.'#cdata-section' hoursLast2Weeks = $gameNode.hoursLast2Weeks hoursOnRecord = $gameNode.hoursOnRecord } $games += $game } $jsonContent = $games | ConvertTo-Json -Depth 100 $jsonFilePath = Join-Path -Path $scriptDirectory -ChildPath $jsonFileName $jsonContent | Set-Content -Path $jsonFilePath Write-Host "Number of entries: $($games.Count)" Write-Host "JSON file created successfully: $jsonFilePath"

copy/paste this into a file with a ps1 extension. Eg. games2json.ps1

If anyone on the forum reposts this in the future, I'd appreciate a linkback. Not just because it's nice to credit other users but because I might modify this message with improvements.
Last edited by metamec; Feb 28, 2024 @ 8:59am
Adam Beckett Feb 28, 2024 @ 10:57am 
Originally posted by metamec:
All the assets (games, dlc, etc.) linked to your account are stored in appcache/appinfo.vdf ...

Appreciate your contribution.

This is exactly the file, I myself looked into.

Yet, it does not store any user-created 'Collection' information, which is the 'key' attribute, I was looking for.

So far, as I can figure out, the 'Collections' created by Steam users are only saved server-side, within each users ID server storage space.

I did not look into local temp files. At some point, I had to give up.
metamec Feb 28, 2024 @ 11:47am 
Sorry, I'm guilty of not paying enough attention.

It appears that when you assign games to collections or favourites, they are recorded very minimally locally in this file:

C:\Program Files (x86)\Steam\userdata\[Your SteamID3]\7\remote\sharedconfig.vdf

Inside the structure is like;

"UserRoamingConfigStore" { "Software" { "Valve" { "Steam" { "apps" { "1286680" { "tags" { "0" "favorite" "1" "TEST COLLECTION" } } "860950" { "tags" { "0" "favorite" "1" "TEST COLLECTION" "1" "TEST COLLECTION#2" } } } } } } }

So you could iterate through that file with a script, building lists of appids assigned to collections:

Eg.

"TEST COLLECTION"="1286680,860950"
"TEST COLLECTION#2"="860950"

But then you would have to pull data associated with the appids from the website or with the API in order to build your JSON.

What a hassle. I wish Valve would stop using proprietary formats for this stuff and store useful data locally in a more sane and readable way.
Last edited by metamec; Feb 28, 2024 @ 11:55am
MalikQayum Feb 28, 2024 @ 2:18pm 
you can find vdf parsers on github that will help with that. or find one that converts the vdf to json. whichever you find easiest.
Last edited by MalikQayum; Feb 28, 2024 @ 2:19pm
metamec Mar 4, 2024 @ 2:10am 
Originally posted by MalikQayum:
you can find vdf parsers on github that will help with that. or find one that converts the vdf to json. whichever you find easiest.

Sorry, I only just saw your reply. The few I tried seem problematic in one way or another. Many don't go deep enough and I've yet to find one that will parse appinfo.vdf. I'm going to try porting Valve's php parser to Typescript and Powershell, because it seems to be the best of the lot.
Last edited by metamec; Mar 4, 2024 @ 2:12am
Kargor Mar 4, 2024 @ 4:31am 
Just in case anyone is interested: the file you're talking about is in the Steam Cloud -- so yes, it's stored serverside.

https://store.steampowered.com/account/remotestorageapp/?appid=7

Just out of curiosity I might try to download it programmatically to see if the API works as I think ( -> steammessages_cloud.steamclient.proto; service Cloud, rpc call ClientFileDownload), but that's likely outside the scope of a simple web thingy that you're probably trying to do.
metamec Mar 4, 2024 @ 5:18am 
It's available both client side and server side.

ETA: Sorry, I misspoke. It looks like the client side is behind the server side and not even synced after every client restart. I'd have expected it be stored on client first then uploaded. Weird. 😵‍💫
Last edited by metamec; Mar 4, 2024 @ 6:16am
Kargor Mar 4, 2024 @ 6:31am 
Originally posted by metamec:
It's available both client side and server side.

Yes, except that there was also a requirement

Originally posted by Adam Beckett:
Viewing the list of owned games without having to load the client or be on a 'Gaming PC' was my goal. Steam Mobile also does not have this 'functionality', of course.

and you never know how current the local files are.

Regardless, since my curiosity was triggered, I just tried it. I have successfully downloaded the file from the Steam cloud, so now I know I can do it (and I'll probably just make an "experimental" subfolder to keep the code...). However, my personal know-how is limited to "clients", so I can follow the Steam protocol on that:

[2024-03-04 15:01:05.355361]: serializing protobuf message CCloud_ClientFileDownload_Request into 22 bytes: {"appid":7,"filename":"sharedconfig.vdf","realm":1}
...
[2024-03-04 15:01:05.779909]: deserialized protobuf message CCloud_ClientFileDownload_Response from 465 bytes: {"appid":7,"file_size":1416,"raw_file_size":1416,"sha_file":"...","time_stamp":"1708218110","url_host":"steamcloud-dub.s3.dualstack.eu-west-1.amazonaws.com","url_path":"...","use_https":true,"request_headers":[{"name":"Host","value":"steamcloud-dub.s3.dualstack.eu-west-1.amazonaws.com"}],"encrypted":false}
...
[2024-03-04 15:01:09.814328]: HTTPClient: "GET" query for "https://steamcloud-dub.s3.dualstack.eu-west-1.amazonaws.com/..." has received a 1416 byte response with code "OK"

I don't know whether an API exists that just works off an API key. Apparently, the thread starter has looked for one, and didn't find one. Of course, I don't know whether he was looking for an API to access game collections, or an API to do cloud downloads...

Also, the "Download file" on the Steam page points back to Steam, while the API above provides a preauthenticated Amazon S3 link. So I'm guessing the webpage uses a different path, which may or may not be easier to follow for people that are more web-centric than I am. However, I suspect that this path still requires valid session cookies, aka a properly authenticated web session -- which, incidentally, I can only get from a client login; I also don't know how to do a web-login...
Last edited by Kargor; Mar 4, 2024 @ 6:33am
MalikQayum Mar 4, 2024 @ 8:30am 
makes no sense to download the file when he has access to it locally. if he were to want to download the file for some reason... he would have to sign in to steam with a script, there are third party libraries that will make it easier so you don't need to write the thing from scratch but.. why do all that when he has access to the file locally?

just by suggesting to download the file to me is something that shouldn't have been posted to begin with as all that did was take away focus from a good solution already provided.
Last edited by MalikQayum; Mar 4, 2024 @ 8:34am
Yuki Feb 26 @ 12:43pm 
This thread was quite old before the recent post, so we're locking it to prevent confusion.
< >
Showing 1-15 of 15 comments
Per page: 1530 50

Date Posted: Feb 27, 2024 @ 10:01am
Posts: 15