clypso-chat
Read live chat from Twitch, Kick and YouTube in Python, and find the moments chat goes wild.
The readers and parsers are written in Rust. They run outside Python's GIL, so watching dozens of channels costs almost no CPU.
Try it in 10 seconds:
pip install clypso-chat
python -m clypso_chat twitch:jynxzi https://kick.com/adinross youtube:@LofiGirl
reading twitch chat of jynxzi
reading kick chat of adinross
reading youtube chat of @LofiGirl
23:48:55 [adinross] ★viewer_one: W stream
23:48:55 [jynxzi] ⚔viewer_two: bro what was that
★ [jynxzi] viewer_three subscribed (1 month)
🔥 HYPE in jynxzi at 23:51:02 chat is going wild (48 msg/s)
jynxzi: 39 messages, adinross: 580 messages, LofiGirl: 91 messages in 15 s
(Shortened, with usernames changed. Hype lines appear once a channel has 2 minutes of chat.)
Or in Python:
import time
import clypso_chat as cc
with cc.Hub() as hub:
stream = hub.join("twitch:jynxzi") # or "kick:adinross", "youtube:@LofiGirl", a channel URL
time.sleep(20)
for author, text, ts in hub.drain(stream):
print(author, ":", text)
No login, API key or OAuth app is needed. Every reader is anonymous and read-only.
Features
- Three platforms, one API:
- Twitch: IRC over TLS.
- Kick: Pusher WebSocket.
- YouTube: the live chat feed of any live video.
- Just the channel name or URL: Kick chatroom ids and YouTube live videos are looked up for you.
- Message details: id, login, name colour, badges, moderator/subscriber/VIP/broadcaster, replies and emotes, when you ask for them.
- A command-line watcher:
python -m clypso_chat CHANNEL...prints chat, events and hype moments. - Many channels at once: every channel shares one small Rust runtime with one OS thread. The readers answer pings, reconnect, back off when blocked, and log what went wrong.
- Hype detection: a per-channel counter spots sudden chat spikes against the channel's own normal rate, and returns the moment in the stream that chat reacted to.
- Platform events:
- Twitch: subs, gift bombs, bits and raids.
- Kick: subs, gifted subs and hosts.
- YouTube: Super Chats, Super Stickers and memberships.
- Chat signals:
- For each second: messages, distinct chatters, reactions ("KEKW", "clip it", "W") and repeated lines.
compact()folds an emote wall into one line, so a burst fits in an AI prompt.
- Fast parsing: up to 7.6× faster than an equivalent pure-Python parser. Pure-Python details are under Speed.
- Typed: full type hints. Wheels for Linux, macOS and Windows on every CPython ≥ 3.10.
Install
pip install clypso-chat
Prebuilt wheels:
| Platform | Wheel |
|---|---|
| Linux x86-64 (glibc ≥ 2.17) | manylinux_2_17_x86_64 |
| Linux ARM64 (glibc ≥ 2.28) | manylinux_2_28_aarch64 |
| macOS Apple Silicon / Intel | macosx_11_0_arm64 / macosx_10_12_x86_64 |
| Windows x86-64 | win_amd64 |
Each wheel works on every CPython ≥ 3.10. It needs no OpenSSL: TLS is rustls with Mozilla's root certificates.
Anywhere else, for example Alpine/musl or Windows ARM, pip builds from source. That needs Rust (rustup, stable) and a C compiler.
Watch from the terminal
python -m clypso_chat twitch:xqc # one channel
python -m clypso_chat https://kick.com/adinross youtube:@LofiGirl twitch:jynxzi
python -m clypso_chat twitch:xqc --quiet # only events and hype moments
python -m clypso_chat twitch:xqc --seconds 60 # stop after a minute
A channel is twitch:NAME, kick:NAME, youtube:@HANDLE (or a video id), or a channel URL. Names are shown in their
own colours, with ⚔ for moderators, ★ for subscribers/members and ◆ for VIPs. Hype detection starts once a channel has 2
minutes of chat.
Read live chat
import time
import clypso_chat as cc
with cc.Hub() as hub:
hub.join("tw", "twitch", "some_streamer") # Twitch channel name
hub.join("kk", "kick", "some_streamer") # Kick channel name (the chatroom id is looked up)
hub.join("yt", "youtube", "@SomeChannel") # YouTube: @handle, channel URL or live video id
hub.join("https://twitch.tv/other_streamer") # or one string: it is also the stream's id
while True:
time.sleep(1)
for stream_id, lines in hub.drain_all():
for author, text, ts in lines:
print(f"[{stream_id}] {author}: {text}")
for line in hub.logs(): # "kk kick chat dropped: ...", reconnects, errors
print("log:", line)
join(id, platform, channel): starts a reader. Theidis your own name for the stream.join("twitch:xqc")orjoin(URL)takes the platform and channel from one string, which is also the id. A YouTube channel that isn't live raisesLookupError.drain(id)/drain_all(): return the messages received since the last call, as(author, text, epoch_seconds)tuples.status(id): returns{connected, received, reconnects, last_error, last_message_at, events, ...}.leave(id): stops one reader. Leaving thewithblock stops them all.
Message details
Make the hub with details=True and read messages as dicts with messages(id) (or messages_all()):
with cc.Hub(details=True) as hub:
hub.join("kick:adinross")
time.sleep(5)
for m in hub.messages("kick:adinross"):
print(m)
{'platform': 'kick', 'author': 'Viewer', 'text': 'W stream KEKW', 'ts': 1796146824.0, 'id': '31613346-…',
'user_id': '1169737', 'login': 'viewer', 'color': '#00F1FF', 'badges': ['subscriber'], 'moderator': False,
'subscriber': True, 'vip': False, 'broadcaster': False, 'first': False, 'reply_to': '', 'emotes': ['KEKW']}
| field | Twitch | Kick | YouTube |
|---|---|---|---|
id, user_id, login |
message id, user id, login | message id, user id, slug | message id, channel id, channel id |
color |
name colour | name colour | — |
badges |
e.g. moderator, subscriber, vip, broadcaster |
e.g. moderator, subscriber, og, vip |
moderator, owner, verified, member |
moderator, subscriber, vip, broadcaster |
✓ | ✓ | moderator, member, owner |
first |
first message in the channel | — | — |
reply_to |
who it replies to | who it replies to | — |
emotes |
Twitch emotes | Kick emotes | custom channel emoji |
drain and messages take from the same queue, so use one or the other. Without details=True, messages still works
and the detail fields are empty. Reading details costs a little more CPU, so it is off by default. For one raw message,
use cc.twitch_message(line), cc.kick_message(data) or cc.youtube_message(action).
Detect hype moments
Counter keeps messages per second and fires when chat jumps well above the channel's recent normal rate. Use it with your own messages, or call hub.tick(id), which counts the hub's messages for you.
import clypso_chat as cc
counter = cc.Counter("twitch")
t = 1_000_000.0
for s in range(300): # 290 calm seconds at 2 msg/s, then 40 msg/s
for _ in range(2 if s < 290 else 40):
counter.add(t + s)
moment = counter.tick(t + s + 1) # call once a second
if moment:
print("chat exploded; the moment was at", moment - t, "s")
chat exploded; the moment was at 284.0 s
The moment comes a few seconds before the burst, because chat reacts after what happened on stream. That makes it the place to start a clip.
You can tune the detector with a dict (the defaults are shown):
cfg = {
"warmup_s": 120, # seconds of chat before it may fire
"baseline_s": 600, # how far back "normal" is measured
"z_on": 3.0, # how many standard deviations above normal counts as a spike
"min_rate": 1.5, # and at least this many messages per second
"chat_lag_s": 4.0, # how far chat trails the stream
"cooldown_s": 45.0, # no second spike within this time
}
counter = cc.Counter("twitch", cfg)
hub = cc.Hub(cfg)
Subs, gifts, raids and Super Chats
for e in hub.events("tw"):
print(e)
{'kind': 'raid', 'user': 'BigStreamer', 'amount': 1200.0, 'detail': '', 'text': '', 'ts': None}
{'kind': 'gift', 'user': 'Gifter', 'amount': 50.0, 'detail': '', 'text': '', 'ts': None}
| kind | Twitch | Kick | YouTube | amount |
|---|---|---|---|---|
sub |
sub, resub (detail: plan) |
subscription | — | months |
gift |
gift bomb, one gifted sub | gifted subs | gifted memberships | subs |
bits |
cheer | — | — | bits |
raid |
raid | host | — | viewers |
superchat |
— | — | Super Chat, Super Sticker (detail: "$5.00") |
the amount |
member |
— | — | new or returning member | months |
A gift bomb is counted once, not once per gifted sub. The same parsers also work on raw messages: twitch_event(line), kick_event(name, data) and youtube_event(item).
What chat is saying
chat = [(f"viewer{i}", "KEKW", 100 + i / 10) for i in range(40)]
chat += [("mod", "he fell off the bridge", 101.5), ("a", "CLIP IT", 102.0),
("b", "clip it!!", 102.2), ("c", "LMAOOO", 102.4)]
chat.sort(key=lambda x: x[2])
cc.signals(chat) # per second: (second, messages, chatters, reactions, repeats)
[(100, 10, 10, 10, 9), (101, 11, 11, 10, 10), (102, 13, 13, 13, 11), (103, 10, 10, 10, 10)]
cc.compact(chat, max=10) # one line per reaction: (author, text, ts, times said, people)
[('viewer0', 'KEKW', 100.0, 40, 40),
('mod', 'he fell off the bridge', 101.5, 1, 1),
('a', 'CLIP IT', 102.0, 2, 2),
('c', 'LMAOOO', 102.4, 1, 1)]
- Matching: lines are compared by
cc.norm(text), which ignores case and punctuation and squashes held letters. "LMAOOO" becomes "lmao" and "KEKW KEKW KEKW" becomes "kekw". - Reactions: the default list is
cc.KEYWORDS. Pass your own withsignals(chat, keywords=[...]). - Over
max:compactkeeps the most repeated reactions and an even spread of the rest, in order.
Parse single messages
To use your own connection, call the parsers directly:
cc.twitch_line("@display-name=Ninja :ninja!ninja@ninja.tmi.twitch.tv PRIVMSG #chan :that was insane")
# ('Ninja', 'that was insane')
cc.kick_item({"content": "W stream", "created_at": "2026-12-01T18:00:00Z", "sender": {"username": "kickfan"}})
# ('kickfan', 'W stream', 1796148000.0)
cc.youtube_item(action) # one item from YouTube's live chat feed → (author, text, ts)
Platform notes
- Twitch: pass the channel name. Anonymous read-only login.
- YouTube chat is polled at the pace YouTube asks for.
- YouTube:
@handle, a channel URL andUC…channel ids are looked up to the current live video (cc.youtube_live_id). - Kick:
- Pass the channel name: the chatroom id is looked up with
cc.kick_room(name). If kick.com refuses, the reader keeps trying on its own;room=<chatroom id>skips the lookup. - The chat WebSocket itself works fine. If Kick changes its public Pusher key, the log says so, and you can pass
Hub(kick_pusher_key="...").
- Pass the channel name: the chatroom id is looked up with
- Failures: a Kick or YouTube reader that keeps failing waits longer each time: 10 s, 20 s, 40 s, up to 5 minutes.
Speed
Measured against a pure-Python implementation of the same readers (4-CPU laptop, python bench/bench.py):
| Python | clypso-chat | Faster | |
|---|---|---|---|
| Twitch parsing, 200k lines | 0.79 s | 0.10 s | 7.6× |
| Kick parsing, 100k events | 0.61 s | 0.15 s | 4.0× |
| Spike detector, per call | 178 µs | 30 µs | 6.0× |
| 1,000,000 messages over 40 streams, read + counted | 14.9 s CPU | 1.03 s CPU | 14.5× |
On 7 real channels at about 8 messages a second, the whole hub uses about 0.1% of one core.
API at a glance
Hub(cfg=None, *, details=False, threads=1, max_lines=20000, kick_pusher_key=None) |
join, leave, drain, drain_all, messages, messages_all, events, tick, rates, quiet, status, streams, logs, close |
Counter(platform="twitch", cfg=None) |
add(ts), tick(now), rates, series, quiet() |
spike(rates, cfg), chat_quiet(rates, cfg), loud_spike(db, cfg) |
the detectors on a plain list of numbers |
twitch_line, kick_item, youtube_item |
one message → (author, text[, ts]) |
twitch_message, kick_message, youtube_message |
one message → a message dict with its details |
kick_room, youtube_live_id, parse_target |
a Kick name → chatroom id; a YouTube channel → live video id; a URL → (platform, channel) |
twitch_event, kick_event, youtube_event |
one message → an event dict or None |
signals, compact, norm, KEYWORDS |
chat signals |
Full signatures are in clypso_chat/_native.pyi, so your editor shows them.
Development
pip install maturin
maturin develop --release && pytest # 119 tests
cargo test # the Rust unit tests
The tests run each reader against local fakes of Twitch IRC, Kick's Pusher socket and YouTube's chat feed: handshakes, pings, reconnects, events and errors. bench/smoke.py reads a few seconds of real chat.
How it plugs into the Clypso clipping engine it was built for is described in docs/CLYPSO.md.
License
MIT
Metadata
Release files for clypso-chat 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clypso_chat-0.2.0.tar.gz | 96.2 kB | With provenance | Details for clypso_chat-0.2.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| clypso_chat-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for clypso_chat-0.2.0-cp310-abi3-win_amd64.whl |
| clypso_chat-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for clypso_chat-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl |
| clypso_chat-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for clypso_chat-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| clypso_chat-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for clypso_chat-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
| clypso_chat-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for clypso_chat-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 12.6 MB
Release files / clypso_chat-0.2.0.tar.gz
| Download URL | clypso_chat-0.2.0.tar.gz |
|---|---|
| Size | 96.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdf7fe838b0f4f956eec0c90f4cb9928bc94fbf2c21c19017c303c22e2535d78
|
|
BLAKE2b-256 checksum How to use checksums |
b219cf5c900ddf4070421af4be8dfe2f8628a0684e7e0c932a50a5835da7c575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / clypso_chat-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | clypso_chat-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8d7a73b3e29d434a8731b760b7e09f6063846e628a70786dd62e3d0be9869322
|
|
BLAKE2b-256 checksum How to use checksums |
4e25d5d4ce8c3fb4ed87a588bda7db01d0eb0bc4c87b8064adc49e2fed04f45b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / clypso_chat-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | clypso_chat-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
aff8ca79bf73521c290890ec514047896c620d613aa5d99afb938fc47cad7770
|
|
BLAKE2b-256 checksum How to use checksums |
54891ec306096300bcbe94e3c9d60c827ecbbf27da7a0a47b9b243c86bf89241
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / clypso_chat-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | clypso_chat-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2b54b26c95aaa24cd405a2b0b25ff1938d61ab3151f7556969ffd09d996aea4d
|
|
BLAKE2b-256 checksum How to use checksums |
ef14d0305310fcced45dbb2afe8de49d4c5a5503d84ffbe825e8b9fb90189054
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / clypso_chat-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | clypso_chat-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fe55cd3cbc4dfd7642367642d7ffa09c9dfb681d8ad22ad3595c371d16389316
|
|
BLAKE2b-256 checksum How to use checksums |
45dc3e6dfd16ec392294a6479fa779483866734b08e5308e68a0c5a988a3caa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / clypso_chat-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | clypso_chat-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1808c027895ac02776a1f52a0a73eff9ac8490533e11a8f35ebad393a00a112
|
|
BLAKE2b-256 checksum How to use checksums |
e7c45626ada9b52a67a517d1edca31e3dc6c5acd7397803324184c13fa903f89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for clypso-chat 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for clypso_chat-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.