Skip to main content

pytchat-ng

pytchat-ng is a python library for fetching youtube live chat (Next Generation).




Description

pytchat 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 pytchat-ng

Examples

Fetch chat data (see wiki)

import pytchat
chat = pytchat.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 pytchat
import time

chat = pytchat.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

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 emojis are represented by ":(shortcut text):"
messageEx str list of message texts and emoji dicts(id, txt, url).
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

MIT License

Metadata

Release files for pytchat-ng 0.5.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytchat-ng 0.5.9
File Size Uploaded Provenance Actions
pytchat_ng-0.5.9.tar.gz 35.8 kB Without provenance Details for pytchat_ng-0.5.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytchat-ng 0.5.9
File Interpreter ABI Platform Actions
pytchat_ng-0.5.9-py3-none-any.whl Python 3 none any Details for pytchat_ng-0.5.9-py3-none-any.whl

Total release size: 84.1 kB

Release files / pytchat_ng-0.5.9.tar.gz

Download URL pytchat_ng-0.5.9.tar.gz
Size 35.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9508aef1674ff9f98fc6620bcc7d51ae8f3a2c4992325ec3efedb1b9ec0b6539
BLAKE2b-256 checksum
How to use checksums
815f8300c83919340022e1064864452af1cbac992ae5091d4b3234d7505d47c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pytchat_ng-0.5.9-py3-none-any.whl

Download URL pytchat_ng-0.5.9-py3-none-any.whl
Size 48.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd68a9c9c3a3873d4450169e0fc7ca02ca177ddb53bbd0fc3550fa6c389d897b
BLAKE2b-256 checksum
How to use checksums
cdde310b76256bbd438e1b86f39269e11c2316e47d0795485439fa6ada3a3d34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for pytchat-ng 0.5.9

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page