Discograph
Visualize your Discord friends network as an interactive graph where each node represents a friend and edges represent mutual friends.
[!CAUTION] This tool uses your Discord user token since it's the only way to access your common friends for any give friend.
- NEVER, under any circumstance, share your user token with anyone as it would give them full access to your account. It also means you are trusting this tool or have reviewed its code to ensure it is safe.
- Using this is against Discord's Terms of Service. Use at your own risk. For a single personal use, I don't think there is much risk, but be aware of it.
See here to get your user token ⚠ the first thing, not the comments with ai garbage below.
[!NOTE] Once on the page, click on the
enabledbutton on thePhysicssection to make the magic happen!
Features
- Fetches your Discord friends and their mutual friends.
- Constructs a network graph where nodes represent friends and edges represent mutual friendships.
- Outputs the graph as an interactive HTML file.
Installation
Recommended: using uv
-
Install uv if you don't have it already.
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Then, either:
- install the tool
uv tool install discograph
- or run it without installing everything, letting uv handle everything for you, by prefixing every following commands with
uvx
Anything else
It's just a normal Python package, so you can use any other tool that installs python packages.
Usage
TLDR;
The most basic and common usage is just the bare command:
discograph
it will:
- ask for your Discord user token
- download your friends and their mutual friends if not already downloaded
- generate the graph in a cache, and open it in your default browser
To refresh the cache (i.e. always download the data from Discord even if already present), use the --update flag:
discograph --update
Instead of interactively inputting your user token, you can provide it by:
- setting the
DISCORD_USER_TOKENenvironment variable - passing it with the
--user-tokenoption
Advanced
The default command is in fact a combination of two commands: download and generate-graph. It is equivalent to:
discograph download --path mutual_friends.json
discograph generate-graph --input mutual_friends.json --output graph.html
but using the default cache paths to store the data.
All commands supports reading/writing from/to stdin/stdout by using - as path. It allows for easy piping between commands, e.g. those three commands are equivalent:
discograph --update
discograph download - | discograph generate-graph -
discograph download mutual_friends.json
cat mutual_friends.json | discograph - -
Except that the first one uses the cache paths, while the two others use the current directory and stdin/stdout.
Documentation
Output help messagges for all commands:
$ discograph --help
Usage: discograph COMMAND [OPTIONS] [ARGS]
Save your Discord mutual friends and visualize them as a graph.
The default behavior is to download the mutual friends data (if not already present) and generate the HTML graph,
then open it in the default web browser.
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ clear Clear the cached data files. │
│ download Download the mutual friends data from the Discord API and save it to JSON. │
│ graph Create the friends network graph HTML from the mutual friends JSON data. │
│ --help (-h) Display this message and exit. │
│ --version Display application version. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Parameters ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ DATA-PATH --data-path --input -i Where to read or save the mutual friends JSON data. Default is in the │
│ operating system's cache directory. Can use "-" for stdin. Does not │
│ supports writing to stdout. Use the download command instead for that. │
│ HTML-PATH --html-path --output -o Where to save the generated HTML graph. Default is in the operating │
│ system's cache directory. Can use "-" for stdout. │
│ --user-secret Set the user secret to use for fetching data. Takes precedence over the │
│ shell variable. │
│ --redownload --update --no-redownload Redownload the data from the Discord API, even if it already exists. │
│ --no-update [default: False] │
│ --progress --no-progress Show progress bars during data fetching. [default: True] │
│ --loglevel [choices: DEBUG, INFO, WARNING, ERROR, CRITICAL] [default: WARNING] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
$ discograph download --help
Usage: default-command download [OPTIONS] [ARGS]
Download the mutual friends data from the Discord API and save it to JSON.
╭─ Parameters ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ PATH --path -p The path to save the mutual friends JSON data. Default is in the operating system's │
│ cache directory. Can use "-" for stdout. │
│ USER-SECRET --user-secret │
│ --progress --no-progress Whether to show progress bars during data fetching. [default: True] │
│ --loglevel [choices: DEBUG, INFO, WARNING, ERROR, CRITICAL] [default: WARNING] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
$ discograph graph --help
Usage: default-command graph [ARGS]
Create the friends network graph HTML from the mutual friends JSON data.
╭─ Parameters ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ INPUT --input -i │
│ OUTPUT --output -o The path to save the generated HTML graph. Default is in the operating system's │
│ cache directory. Can use "-" for stdout. │
│ loglevel --loglevel [choices: DEBUG, INFO, WARNING, ERROR, CRITICAL] [default: WARNING] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
$ discograph clear --help
Usage: default-command clear [OPTIONS]
Clear the cached data files.
╭─ Parameters ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --all-version --no-all-version Clear everything, including files from previous versions. [default: False] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Metadata
Release files for discograph 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discograph-0.2.4.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discograph-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / discograph-0.2.4.tar.gz
| Download URL | discograph-0.2.4.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
198a05590daa57867ae224cba7e50ed5323e311291d04f300e0b3e0ce5143ccb
|
|
BLAKE2b-256 checksum How to use checksums |
28b87ab6573b9087215ea8d108f5864bab4707fe26d7d30bb5f312c79f73a095
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / discograph-0.2.4-py3-none-any.whl
| Download URL | discograph-0.2.4-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2f25b0e8ed746604b20e32b40aff4c8e9513711e428a75bc6103f9efb40e48e
|
|
BLAKE2b-256 checksum How to use checksums |
1005c3b3b15b0efbf7c2af3edc49b4bb64b5d0b35194cb5946126326c4a5bf1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|