
pytchat is a python library for fetching youtube live chat.
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.
wiki (Japanese)
Install
pip install pytchat
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())
'''
Project Repository
GitHub : github.com/taizan-hokuto/pytchat
Wiki : github.com/taizan-hokuto/pytchat/wiki
other
This content has been shared for Educational And Non-Profit Purpose ONLY