Twitch Chat Downloader 
Neat python script to download chat messages from past broadcasts
Requirements
Installation and usage
There are multiple ways to install this script.
# Install package with pip
pip3 install tdh-tcd
python3 -m tcd <video_id>
# Run pip3 as root to install `tcd` for all users (not recommended)
sudo pip3 install tdh-tcd
tcd <video_id>
# Start script directly from cloned repository
git clone https://github.com/TheDrHax/Twitch-Chat-Downloader.git
cd Twitch-Chat-Downloader
pip install -r requirements.txt
python -m tcd <video_id>
# or ...
python app.py <video_id>
Settings
To override default options, run python -m tcd --generate-config and edit generated settings.json or just use console arguments listed below.
| Option | Type | Argument | Description |
|---|---|---|---|
| client_id | str | --client-id |
Twitch API Client-ID header. |
| cooldown | int | --cooldown |
Delay (in milliseconds) between API calls. |
| display_progress | bool | --[no-]progress |
Display animated progress bar in terminal. |
| formats | str[] | -f/--formats |
List of formats to download. See Formats table below. |
| directory | str | -t/--directory |
Name of directory to save all generated files. |
| filename_format | str | --filename-format |
Full format of generated filenames. Possible arguments: directory, video_id and format. |
| max_width | int | --max-width |
Add line breaks to fit messages into specified width. Note: Implemented only for SSA/ASS subtitles. |
| subtitle_duration | int | --subtitle-duration |
Duration (in seconds) of each line of subtitles. |
| dynamic_duration | obj | Increase subtitle duration based on message length. | |
| —.enabled | bool | --[no-]dynamic-duration |
Enable or disable this function. |
| —.max | int | --dynamic-duration-max |
Maximum duration of subtitle message. |
| —.max_length | int | --dynamic-duration-max-length |
Maximum length of subtitle message. |
| millisecond_separator | str | --millisecond-separator |
Separator between seconds and milliseconds in timestamps (IRC only). |
| group_repeating_emotes | obj | Convert Kappa Kappa Kappa to Kappa x3. |
|
| —.enabled | bool | --[no-]group |
Enable or disable this function. |
| —.threshold | int | --group-threshold |
Number of repeating emotes to trigger this function. |
| —.collocations | int | --group-collocations |
Maximum number of words in repeating collocations (default: 1, more is slower). |
| —.collocations_threshold | int | --group-collocations-threshold |
Same logic as in —.threshold, but applies only to repeating collocations. |
| —.format | str | --group-format |
Customize format of replaced emotes. |
| badges | obj | Add badges before the username (IRC only). | |
| —.enabled | bool | --[no-]badges |
Enable or disable this function. |
| —.max_count | int | --badges-max |
Only show the first N badges (default: 1) |
| —.map | obj | Configure which symbol corresponds to a specific badge. | |
| video_types | str | --video-types |
Comma-separated list of VOD types to detect in Channel Mode. (see broadcast_type) |
Formats
| Format | Description |
|---|---|
ass or ssa |
Advanced SubStation Alpha |
srt |
SubRip |
irc |
IRC-style log |
SSA/ASS Events Line Format
The ssa_events_line_format option controls how each chat message is written as an SSA/ASS Dialogue event (used by the ass/ssa formats). It must follow the SSA events Format: line declared by ssa_events_format, and may contain these placeholders:
| Placeholder | Description |
|---|---|
{start} |
Start time |
{end} |
End time |
{user} |
Colored username. |
{message} |
Message text |
{badge} |
First max_count badge symbols (see the badges option). |
{badges} |
All badges formatted as moderator=1;subscriber=6. |
Notes
- Empty messages means the user has been timed out. There's no known way to get these.
- This script is using Twitch's API v5 that is deprecated.
- Consider increasing the delay between API calls in
settings.jsonto avoid a potential temporary block from Twitch for sending too many requests when downloading messages from very long streams.
Metadata
Release files for tdh-tcd 2.5.6
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 |
|---|---|---|---|---|
| tdh_tcd-2.5.6.tar.gz | 13.6 kB | Without provenance | Details for tdh_tcd-2.5.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tdh_tcd-2.5.6-py3-none-any.whl | Python 3 | none | any | Details for tdh_tcd-2.5.6-py3-none-any.whl |
Total release size: 26.8 kB
Release files / tdh_tcd-2.5.6.tar.gz
| Download URL | tdh_tcd-2.5.6.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d16f83599436ff3bc9c1d433e713b3a095a1cbf0762a1a52b664ff0ffa3a61c
|
|
BLAKE2b-256 checksum How to use checksums |
5f9d84b87f391c059d3f73d2fae4b6cd1ab3075f4f010284ce63c9099e8ee004
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / tdh_tcd-2.5.6-py3-none-any.whl
| Download URL | tdh_tcd-2.5.6-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e13a9130256543751e7d7d9c6020db11c444c77ec9668602dbf49463b5ebc11a
|
|
BLAKE2b-256 checksum How to use checksums |
c0fdf51d5886e204fa68704bd9e491fc8c52870437d6557bb6b665d6ad2ed2d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for tdh-tcd 2.5.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.