Export your PlayStation Network play history to CSV/JSON and build an LLM-ready taste profile (with prompts), entirely on your machine.
Project description
psnstats
Export your PS4/PS5 play history from the PlayStation Network to CSV/JSON, and optionally build an LLM-ready taste profile (with prompts), entirely on your machine.
psnstats is an end-user command-line tool, not an API wrapper. It fetches every PS4/PS5 title you have played (playtime, play counts, last played), writes them to files you own, and can layer on trophy completion, a taste-analysis profile for LLM use, a run-to-run diff, and a store wishlist export. It deliberately skips PSN's social surface (friends, presence, messaging, search); if you need those, use psnawp directly, which this tool is built on.
How to install
From PyPI
pipx install awesome-psnstats
(or pip install awesome-psnstats). The console command is psnstats.
Getting Started
[!CAUTION] This tool uses an unofficial, reverse-engineered PlayStation Network API (via the
psnawplibrary, which self rate limits at 300 requests per 15 minutes). Normal, occasional runs are low-risk, but excessive use may lead to your PSN account being temporarily or permanently banned. Your NPSSO token is a session cookie equivalent to your password:psnstatssends it only to Sony's own API endpoints, and nothing else leaves your machine.
To get started you need to obtain your npsso (64 character code):
- Log in to your PlayStation account in your browser.
- In another tab of the same browser, go to
https://ca.account.sony.com/api/v1/ssocookie. - If you are logged in you should see a text similar to this:
{"npsso":"<64 character npsso code>"}
The npsso expires after about 60 days; get a fresh one when authentication starts failing.
Following is a quick example of how to use this tool:
export PSN_NPSSO="<64 character npsso code>"
# Base export: library CSV + JSON into ./psn-export/
psnstats
# Add the taste profile (preferences.json, traits, report)
psnstats --analyze
# Enrich with trophy completion, and also export your store wishlist
psnstats --analyze --trophies --wishlist
# Diff against a previous run
psnstats --analyze --compare ./psn-export/preferences.json
# Another account's public library
psnstats --user VaultTec-Co
A run with --analyze prints a report like this (synthetic data from examples/):
----------------------------------------------------------------------
TOP 10 GAMES (by enjoyment)
----------------------------------------------------------------------
# Title Sys Score Hrs Plays Last
----------------------------------------------------------------------
1 Elden Ring PS5 91.2 120 340 2026-07
2 Bloodborne PS4 79.2 62 90 2026-05
3 Stardew Valley PS4 79.0 90 180 2026-06
...
----------------------------------------------------------------------
PLAYER TRAITS
----------------------------------------------------------------------
Snackable [##############------] 71.4 (sessions/hr: 2.10 median)
Marathon [############--------] 64.3 (hrs/session: 0.5 median)
Completionist [##########----------] 50.0 (completion: 58% avg)
Friction Tol [###-----------------] 17.9 (early: 14%, late: 29%)
Variety [###################-] 95.0 (entropy: 1.00)
How the analysis works
With --analyze, every game gets an enjoyment score (0-100), a weighted blend of four signals:
enjoyment = 0.35 * playtime (log-scaled)
+ 0.25 * recency (90-day half-life decay)
+ 0.20 * completion (neutral 50 without --trophies)
+ 0.20 * replay (play count + long-session bonuses)
Two abandonment penalties then apply: -15 if you bounced early (under 20% complete after 3+ sessions) and -10 if you stalled late (10+ hours in, under 40% complete). Completion signals require --trophies; without it, completion goes neutral.
From the per-game scores it derives five player traits (each 0-100): snackable (short, frequent bursts), marathon (long single sittings), completionist (how far into games you push), friction tolerance (whether you stick with hard/slow games or drop them), and variety (spread across platforms and kinds of games).
preferences.json also carries an agent_features block: session style, commitment style, platform recency split, plain-language positive/avoid signals, and the exact weights and thresholds used, so an LLM can reason about why a score is what it is.
Example prompts
preferences.json is written to be pasted straight into a chat with an LLM:
Get recommendations:
Here is my PlayStation taste profile as JSON. Based on the traits, enjoyment scores, and positive/avoid signals, recommend 5 games I haven't played that fit how I actually play, and for each, say which signal it matches.
{ ...paste the contents of preferences.json... }
Triage your backlog (paste library.csv too):
Here are my taste profile and full play history. Which games I started but didn't finish are worth going back to, and which should I officially drop? Use my friction tolerance and abandonment signals to justify each call.
Buy advice:
Here is my taste profile. I'm considering buying . Predict how likely I am to actually finish and enjoy it, citing the specific traits and signals that support the prediction. Be honest if it matches my avoid signals.
Rank your wishlist (run with --wishlist, paste wishlist.json too):
Here are my taste profile and my store wishlist. Rank the wishlist by how likely I am to actually play and finish each game, not by hype. Flag anything that matches my avoid signals, and tell me which one to buy next and which to quietly remove.
preferences.json and the wishlist files keep stable, un-dated names, so you can point a tool or agent at them and re-run monthly to keep them fresh.
Output files
Everything goes to ./psn-export/ (change with --output):
psn_library_<date>.csv: the per-game export (see schema below)psn_export_<date>.json: the same data as JSONpreferences.json: the taste profile (--analyze; stable filename)psn_report_<date>.md: the report as markdown (--format md)wishlist.csv/wishlist.json: your store wishlist (--wishlist; stable filenames) with name, edition, platforms, and current base/discounted price
With --analyze, psn_library_<date>.csv has 12 columns:
| Column | Meaning |
|---|---|
title |
Game name |
system |
PS4 / PS5 / OTHER |
playtime_hours |
Total hours played (float) |
play_count |
Number of sessions |
last_played |
Date last played (YYYY-MM-DD) |
enjoyment_score |
0-100 blended score |
completion_ratio |
0-1 trophy completion (blank without --trophies) |
recency_days |
Days since last played |
hours_per_session |
Marathon signal |
sessions_per_hour |
Snackability signal |
early_abandon |
Bounced early (bool) |
late_abandon |
Stalled late (bool) |
Without --analyze, the CSV is a leaner base export (title, ids, playtime, plays, last played).
Flag reference
Authentication (precedence: --npsso > --npsso-file > $PSN_NPSSO)
--npsso TOKEN: pass the token inline--npsso-file PATH: read from a file (default probe:~/.config/psnstats/npsso;chmod 600it)
Scope
--user ONLINE_ID: export another account's public library instead of your own--platforms LIST: comma list ofps4,ps5,other(defaultps4,ps5)--min-hours N: skip titles under N hours (default1; use0for a full dump)--limit N: stop after N kept titles (handy for a quick test)--wishlist: also export your store wishlist (own account only; can't combine with--user)
Enrichment
--trophies: fetch trophy completion (fills completion + abandonment; adds ~80 requests on a 400-game library)
Analysis
--analyze: compute the taste profile (default: off)--compare PATH: diff this run against a previouspreferences.json(implies--analyze)
Output
--output DIR: output directory (default./psn-export)--format LIST: comma list ofcsv,json,md,all(defaultcsv,json);mdis the report and implies--analyze
Display
--top N,--sort enjoyment|hours|recent|title,--quiet,--silent,--verbose,--no-color,--version
Exit codes: 0 ok · 1 fatal · 2 auth · 3 nothing matched.
About your NPSSO token
- An NPSSO is a session cookie. Treat it like a password: anyone with it can act as you on PSN.
- It expires after ~60 days; regenerate it when auth starts failing.
psnstatssends it only to Sony's own API endpoints, never to any third party.- Prefer a file over an env var for long-term use, and lock it down:
chmod 600 ~/.config/psnstats/npsso.psnstatswarns if the file is group/world-readable. - Avoid the inline
--npssoflag except for a quick test: it lands in your shell history and is visible inpsoutput. Use--npsso-fileor$PSN_NPSSOinstead.
FAQ
Can I export PS3 or Vita playtime? No. Sony's API does not expose playtime for PS3/Vita titles, so no tool can.
Will this get my account banned? It uses the same unofficial API as other community tools, plus psnawp's built-in rate limiting (300 req / 15 min). Normal, occasional runs are low-risk, but there is no official guarantee. Don't hammer it.
Can I export a friend's library? Only their public titles, via --user THEIR_ONLINE_ID, and only if their privacy settings allow it.
Can I export my wishlist? Yes: --wishlist writes wishlist.csv/wishlist.json with name, edition, platforms, and current price/discount (your own account only; Sony exposes no public wishlist). There is no documented wishlist API, so this rides the same persisted GraphQL query the PS App uses. If Sony rotates it, the flag fails with a clear error until psnstats updates the query.
Roadmap
- Purchased-games list, for an "owned but never played" backlog report
- Genre/metadata enrichment (external catalog join)
- A Steam adapter reusing the same pure analysis engine
stdoutstreaming for piping into other tools
Contribution
Bug reports, feature requests, and PRs are all welcome. Dev setup:
git clone https://github.com/t3chnaztea/awesome-psnstats
cd awesome-psnstats
pip install -e ".[dev]"
ruff check . && pytest
Disclaimer
This project was not intended to be used for spam, abuse, or anything of the sort, and no such use is endorsed. psnstats is an unofficial tool, not affiliated with, endorsed by, or supported by Sony Interactive Entertainment. "PlayStation", "PS4", and "PS5" are trademarks of Sony Interactive Entertainment Inc.
Credit
Built on the excellent psnawp library, which handles authentication, rate limiting, and the title-stats and trophy endpoints. Special thanks to @andshrew for documenting the PlayStation API endpoints, including the wishlist query this tool uses.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awesome_psnstats-1.1.1.tar.gz.
File metadata
- Download URL: awesome_psnstats-1.1.1.tar.gz
- Upload date:
- Size: 36.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eba927d5fe53ef095a83d3995d1baf997937a9110488e6060d0f469f07d8bdd3
|
|
| MD5 |
5e576cefdaa25bc70b9d5e6280e75cb3
|
|
| BLAKE2b-256 |
2197f2160054cde7a47b1d226b4a9fd12aed021c46b05dd6f7303ce528e85ef2
|
Provenance
The following attestation bundles were made for awesome_psnstats-1.1.1.tar.gz:
Publisher:
release.yml on t3chnaztea/awesome-psnstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awesome_psnstats-1.1.1.tar.gz -
Subject digest:
eba927d5fe53ef095a83d3995d1baf997937a9110488e6060d0f469f07d8bdd3 - Sigstore transparency entry: 2158290391
- Sigstore integration time:
-
Permalink:
t3chnaztea/awesome-psnstats@9cc337416a30e43403345a840d3e991e47502f73 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/t3chnaztea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9cc337416a30e43403345a840d3e991e47502f73 -
Trigger Event:
push
-
Statement type:
File details
Details for the file awesome_psnstats-1.1.1-py3-none-any.whl.
File metadata
- Download URL: awesome_psnstats-1.1.1-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc9dcbb5ac7f7ebb4fdce26dc23e7cd99a97745eb66133c63bf2b0da781c8b60
|
|
| MD5 |
3bb281f30cd1f66393b081f20b44120a
|
|
| BLAKE2b-256 |
0b1bc206485f738ca9f921c974d7055725aae198696b8f8be0bf153b54e73f9a
|
Provenance
The following attestation bundles were made for awesome_psnstats-1.1.1-py3-none-any.whl:
Publisher:
release.yml on t3chnaztea/awesome-psnstats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
awesome_psnstats-1.1.1-py3-none-any.whl -
Subject digest:
fc9dcbb5ac7f7ebb4fdce26dc23e7cd99a97745eb66133c63bf2b0da781c8b60 - Sigstore transparency entry: 2158290461
- Sigstore integration time:
-
Permalink:
t3chnaztea/awesome-psnstats@9cc337416a30e43403345a840d3e991e47502f73 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/t3chnaztea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9cc337416a30e43403345a840d3e991e47502f73 -
Trigger Event:
push
-
Statement type: