Skip to main content

Douyu Statistics Tools - analyze danmu data with rank, cluster, and search.

Project description

dystat

Douyu Statistics Tools - analyze danmu data with rank, cluster, and search.

Installation

pip install dystat

Quick Start

# Set DSN
export DYKIT_DSN="postgresql://user:pass@localhost:5432/douyu"

# Show version
dystat --version

# Rank users by message count
dystat rank -r 6657 --top 10

# Rank content (repeated messages)
dystat rank -r 6657 --by content --top 10

# Cluster similar messages
dystat cluster -r 6657 --threshold 0.5

# Search messages
dystat search -r 6657 --content "hello"
dystat search -r 6657 --user "username"

Commands

rank

Rank users or content by frequency.

dystat rank -r 6657 --top 10                    # Top users (default)
dystat rank -r 6657 --by content --top 10      # Repeated content
dystat rank -r 6657 --type dgb --top 5         # Gift messages
dystat rank -r 6657 --days 7                   # Last 7 days

Options:

  • -r, --room ROOM - Room ID (required)
  • --top N - Number of results (default: 10)
  • --by user|content - Rank mode (default: user)
  • --type TYPE - Message type (default: chatmsg)
  • --days N - Limit to recent N days
  • --from TIME - Start time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
  • --to TIME - End time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS, inclusive)
  • --last N - Use latest N messages as source window
  • --first N - Use earliest N messages as source window

cluster

Cluster similar messages using fuzzy text matching.

dystat cluster -r 6657 --threshold 0.5         # Default threshold
dystat cluster -r 6657 --limit 100             # More source messages

Options:

  • -r, --room ROOM - Room ID (required)
  • --threshold FLOAT - Similarity threshold 0-1 (default: 0.5)
  • --limit N - Source message limit (default: 50)
  • --type TYPE - Message type (default: chatmsg)
  • --from TIME - Start time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
  • --to TIME - End time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS, inclusive)
  • --last N - Use latest N messages as source window
  • --first N - Use earliest N messages as source window
  • --days N - Limit to recent N days

search

Search messages with filters.

dystat search -r 6657 --content "hello"        # ILIKE search
dystat search -r 6657 --user "username"        # By username
dystat search -r 6657 --type dgb               # By message type

Options:

  • -r, --room ROOM - Room ID (required)
  • --content TEXT - Content filter (ILIKE)
  • --user USERNAME - Username exact match
  • --user-id UID - User ID exact match
  • --type TYPE - Message type
  • --from TIME - Start time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
  • --to TIME - End time (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS, inclusive)
  • --last N - Return latest N messages (default window size: 100 when --first/--last omitted)
  • --first N - Return earliest N messages

Environment Variables

Variable Description
DYKIT_DSN PostgreSQL connection string
DYSTAT_DSN Alias for DYKIT_DSN

License

MIT

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

dystat-0.1.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

dystat-0.1.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file dystat-0.1.2.tar.gz.

File metadata

  • Download URL: dystat-0.1.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dystat-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f34c0328883f526aaedffc3b011df826b74ddd2a9182a0e47c9fdc18af9f7176
MD5 4c43710e5d1699149828f02b5fc9f824
BLAKE2b-256 d6de728a3585ae6f3a91df74f72bad2e54f82d420d477aa48a3d618842f01721

See more details on using hashes here.

File details

Details for the file dystat-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dystat-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dystat-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c77f5e92420ec736d080e89f8015d5f6a339fa3a735c9cf62726782b02d2e4f9
MD5 2ae3c3a290f52b8583c8a761bb551516
BLAKE2b-256 1814b693749de941860de551460935b99a62bf81d7247b5ecc413b995cf8a0b9

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