Skip to main content

Add your description here

Project description

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.

  1. 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.
  2. 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 in the page, click on the enabled button on the Physics section 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

  1. 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
    
  2. 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_TOKEN environment variable
  • passing it with the --user-token option

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]                   │
│ --logging-level                        [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]                    │
│ --logging-level            [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.                                           │
│ LOGGING-LEVEL --logging-level  [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]        │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

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

discograph-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discograph-0.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file discograph-0.1.0.tar.gz.

File metadata

  • Download URL: discograph-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

File hashes

Hashes for discograph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ae134358ecf31ca64b75acf9bf3c21b06cb37e339c25d7592374619063ec87c
MD5 9e71e373348f7ac343fa454f5a344592
BLAKE2b-256 807efbe6ca67032d10ea4f5197cd8d8dc8c66c5cb16a336baa4b60b5ec6bb439

See more details on using hashes here.

File details

Details for the file discograph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: discograph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}

File hashes

Hashes for discograph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fdc755cec65c82b68ea59787b26581ba8dffa100c69849b42367bc434be2ebe
MD5 2382b09add031c22bac80b0e1c3a0724
BLAKE2b-256 92a7e77828fab96288d9b5bd41957b82bf599cc4161878a04b53c31c50c9bd33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page