Skip to main content

Twitch chat analyzer from past broadcasts, designed for Jupyter notebook

Project description

twitch-chat-analyzer-py

Twitch chat analyzer from past broadcasts, designed for Jupyter notebook.

Getting Started

Installation

The package can be installed by pip command in terminal

pip install --upgrade twitch-chat-analyzer

Run Jupyter Notebook

The package is mainly intended to be used in Jupyter notebook, but it can still be used in standard Python environment

Instruction to install Jupyter notebook (or newer JupyterLab) is here

After installation, run the following command in terminal to start Jupyter

jupyter notebook or jupyter-lab

Download chats from past broadcast

notebook.ipynb has examples of statistics functions.

from twitch_chat_analyzer import analyzer

# Create an analyzer object from video ID.
# Video ID is the last part of the video URL (1234567890 in https://www.twitch.tv/videos/1234567890)
# If the chat log was not downloaded before, it will download automatically and create an analyzer.
ann = analyzer.FromVideoId('REPLACE_HERE_TO_VIDEO_ID')

# Some pre-built statistics functions to draw graph
ann.DrawChatPerMinute(10)  # Chat counts for each N-minute interval
ann.DrawTopChatters(20)  # Top N viewers with most chats
ann.DrawTopEmotes(15)  # Top N most used emotes

# If you just want to get the data
ann.GetChatPerMinute(10)  # Chat counts for each 10-minute interval, list of (offset, count)
ann.GetTopChatters()  # Viewer names and chat counts, list of (name, chat_count), sorted by chat count
ann.GetEmoteCounts()  # Emotes and usage counts, list of (emote_name, count), sorted by count

# If you want to handle dataframe yourself
df = ann.ToDataFrame()

# Some useful functions to deal with dataframe
df[df['is_sub_notice']]  # Show new/renew subscription notice messages
df[df['bits'] > 0]  # Show messages with bits
df['text_body'].apply(len).mean()  # Average chat length (excluding emotes)

DataFrame

The dataframe returned from ToDataFrame() has the following columns

Column name type meaning
offset float Time of the chat, in seconds after stream started
username str Twitch login username
display_name str Display name in chat, which may not be in English
name str Combined name of username and display_name, as displayed in Twitch chat
body str Raw chat content, including emote text
text_body str Chat content excluding emotes
is_subscriber bool if the chatter is a subscriber
bits int Amount of bits spent in the chat
is_sub_notice bool if the chat is new/renew subscription notice

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

twitch-chat-analyzer-0.0.5.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

twitch_chat_analyzer-0.0.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file twitch-chat-analyzer-0.0.5.tar.gz.

File metadata

  • Download URL: twitch-chat-analyzer-0.0.5.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.3

File hashes

Hashes for twitch-chat-analyzer-0.0.5.tar.gz
Algorithm Hash digest
SHA256 47a64e48563b8cba5de317880942c7c1359604976199bd8cefde3bac9f628365
MD5 55abcc94d184fbf613f7e496b19f7f2c
BLAKE2b-256 f53fc69112fe8e9377f78f5925ea63116506b678979c41535eb84633f7a38f7f

See more details on using hashes here.

File details

Details for the file twitch_chat_analyzer-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: twitch_chat_analyzer-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.3

File hashes

Hashes for twitch_chat_analyzer-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5de41bb0a1fec5ec2b4327db3e0b3ae4bddc95011168c34b8ed01670fb3c2ae6
MD5 e781e8439a29e37c7f26c413acdc891f
BLAKE2b-256 5f5a29295133a2d26a281e40408560b61b42c0bdcfb2410146d469401bca3411

See more details on using hashes here.

Supported by

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