This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
ReplayChat
taizan-hokuto edited this page Jan 13, 2020
·
15 revisions
This feature is already integrated into LiveChat
ReplayChat object
- fetches past chat data of archived videos and stores them in buffer with ThreadpoolExecutor.
- responds to user inquiries of get().
- invokes callback function with processed chat data.
- can retrieve chat data disabled by editing video.
from pytchat import ReplayChat
import time
chat = ReplayChat("gb01h_eT0pw", seektime = 1000, callback = disp)
while chat.is_alive():
time.sleep(3)
def disp(data):
for c in data.items:
print(f"{c.datetime} [{c.author.name}]-{c.message} {c.amountString}")
time.sleep(3)
name | type | required | remarks | default value |
---|---|---|---|---|
video_id | str | * | ID of youtube video. | - |
processor | ChatProcessor | DefaultProcessor | ||
buffer | Buffer | buffer of chat data fetched background. | Buffer(maxsize=20) | |
interruptable | bool | True | ||
callback | func | [optional] function called from _listen() periodically. | None | |
done_callback | func | [optional] function called when listener ends. | None | |
direct_mode | bool | If True, invoke specified callback function without using buffer. | False | |
seektime | int | seek time of chat (seconds). | 0 (*start of chat data. If youtube stores chatdata of waiting time, the start timestamp is negative value.) |
description | return value |
---|---|
Get processed chat data from buffer. | processed chat data |
description | return value |
---|---|
pause chat fetching to buffer. | - |
description | return value |
---|---|
resume chat fetching to buffer. | - |
description | return value |
---|---|
Check if chat stream is alive. | bool |
description | return value |
---|---|
Terminate fetching chat. | - |