DefaultProcessor is a default chat processor of pytchat.
import pytchat
# `DefaultProcessor` parameter is optional.
chat = pytchat .create (video_id = "uIx8l2xlYVY" , processor = DefaultProcessor ())
while chat .is_alive ():
for c in chat .get ().sync_items ():
print (f"{ c .datetime } [{ c .author .name } ]- { c .message } " )
description
return value
Get list of chat items .
List of chat items
*When you use async_items()
, use async for
sentence.
async for c in chat .get ().async_items ():
print (c .json ())
description
return value
wait for next chat.
-
[await] tick_async() [DEPRECATE]
description
return value
wait for next chat on asyncio context.
-
return JSON format chat data.
chat = pytchat .create (video_id = "xxxxxxxx" )
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().sync_items():
print(c.json())
'''
name
type
remarks
type
str
"superChat","textMessage","superSticker","newSponsor"
id
str
message
str
Emojis are represented by ":(shortcut text):"
messageEx
str
List of messages and emojis: emojis are represented by URL for image.
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 (ARGB)
author
object
see author
colors
object
see colors
Attributes of author object.
name
type
remarks
name
str
channelId
str
chatter's channel ID.
channelUrl
str
imageUrl
str
chatter's icon
badgeUrl
str
member badge
isVerified
bool
isChatOwner
bool
isChatSponsor
bool
when the chat is superchat/supersticker, always False
isChatModerator
bool
Attributes of colors object.
name
type
remarks
headerBackgroundColor
int (ARGB)
available only type:`superChat`
headerTextColor
int (ARGB)
available only type:`superChat`.
bodyBackgroundColor
int (ARGB)
available only type:`superChat`. Same as `bgColor`.
bodyTextColor
int (ARGB)
available only type:`superChat`
timestampColor
int (ARGB)
available only type:`superChat`
authorNameTextColor
int (ARGB)
available only type:`superChat` and `superSticker`
backgroundColor
int (ARGB)
available only type:`superSticker` Same as `bgColor`.
moneyChipBackgroundColor
int (ARGB)
available only type:`superSticker`
moneyChipTextColor
int (ARGB)
available only type:`superSticker`