ThemeMasterChat
ThemeMasterChat is a python library for fetching youtube live chat.
Forked from pytchat-ng (revertical), itself forked from pytchat (taizan-hokuto). As of v0.1.1.0, the Python import package is
thememasterchat(previouslypytchat). Upgrading from an older ThemeMasterChat release?pip install -U thememasterchatreplaces its oldpytchatimport directory. You no longer need to uninstall the originalpytchat/pytchat-ngto use ThemeMasterChat, but if they remain installed,import pytchatwill resolve to those packages.
Description
ThemeMasterChat is a python library for fetching youtube live chat without using Selenium or BeautifulSoup.
Other features:
- Customizable chat data processors including youtube api compatible one.
- Available on asyncio context.
- Quick fetching of initial chat data by generating continuation params instead of web scraping.
For more detailed information, see wiki.
Install
pip install thememasterchat
Import name and compatibility alias
The installed package is ThemeMasterChat, imported from thememasterchat:
import thememasterchat
chat = thememasterchat.create(video_id="VIDEO_ID")
Compatibility alias for existing pytchat code
If you do not want to rename your existing pytchat references, use a local Python import alias:
import thememasterchat as pytchat
chat = pytchat.create(video_id="VIDEO_ID")
This is only a local Python import alias. The installed package is still ThemeMasterChat, imported from thememasterchat; the alias does not install or re-export the original pytchat package.
Examples
Fetch chat data (see wiki)
import thememasterchat
chat = thememasterchat.create(video_id="uIx8l2xlYVY")
while chat.is_alive():
for c in chat.get().sync_items():
print(f"{c.datetime} [{c.author.name}]- {c.message}")
Output JSON format string (feature of DefaultProcessor)
import thememasterchat
import time
chat = thememasterchat.create(video_id="uIx8l2xlYVY")
while chat.is_alive():
print(chat.get().json())
time.sleep(5)
'''
# Each chat item can also be output in JSON format.
for c in chat.get().items:
print(c.json())
'''
other
-
Fetch chat with a buffer (LiveChat)
-
Use with asyncio (LiveChatAsync)
-
YT API compatible chat processor (CompatibleProcessor)
Structure of Default Processor
Each item can be got with sync_items() function.
| name | type | remarks |
|---|---|---|
| type | str | "superChat","textMessage","superSticker","newSponsor" |
| id | str | |
| message | str | Native emojis use Unicode where available; custom emojis use ":(shortcut text):". Full URLs are restored from navigation metadata when reliable, including destinations decoded from YouTube redirect URLs. |
| messageEx | str | list of message texts and emoji dicts(id, txt, url). Emoji txt uses shortcut text for compatibility. |
| timestamp | int | unixtime milliseconds |
| datetime | str | e.g. "2019-10-10 12:34:56" |
| elapsedTime | str | elapsed time. (e.g. "1:02:27") *Replay Only. |
| amountValue | float | e.g. 1,234.0 |
| amountString | str | e.g. "$ 1,234" |
| currency | str | ISO 4217 currency codes (e.g. "USD") |
| bgColor | int | RGB Int |
| author | object | see below |
Structure of author object.
| name | type | remarks |
|---|---|---|
| name | str | |
| channelId | str | *chatter's channel ID. |
| channelUrl | str | |
| imageUrl | str | |
| badgeUrl | str | |
| isVerified | bool | |
| isChatOwner | bool | |
| isChatSponsor | bool | |
| isChatModerator | bool |
Licence
Metadata
Release files for thememasterchat 0.1.1.1
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 |
|---|---|---|---|---|
| thememasterchat-0.1.1.1.tar.gz | 41.5 kB | Without provenance | Details for thememasterchat-0.1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thememasterchat-0.1.1.1-py3-none-any.whl | Python 3 | none | any | Details for thememasterchat-0.1.1.1-py3-none-any.whl |
Total release size: 93.0 kB
Release files / thememasterchat-0.1.1.1.tar.gz
| Download URL | thememasterchat-0.1.1.1.tar.gz |
|---|---|
| Size | 41.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a529f77c06630a7117403a852b7c89d272844c6658f0006d840a5f82e078fc31
|
|
BLAKE2b-256 checksum How to use checksums |
c6a8e9d7f23dc1823677250c6fb84e24521b936d358c459fbb47b0057b934dbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / thememasterchat-0.1.1.1-py3-none-any.whl
| Download URL | thememasterchat-0.1.1.1-py3-none-any.whl |
|---|---|
| Size | 51.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e45dc84f626fad4ac5db6d1c28e72df6b7dda509b8406b2394525797950a561
|
|
BLAKE2b-256 checksum How to use checksums |
e85bd574e18c7d52172bc29ec7c5d9ed960f11b32fe8a024a92bdb3bc00ff024
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for thememasterchat 0.1.1.1
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.