Files
UltraChat/govno/yt.Id_540000269690007.py
sShemet ade2833df7 init
2025-12-22 14:03:10 +05:00

32 lines
779 B
Python

import pytchat
import time
import json
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime):
return o.isoformat()
if isinstance(o, bytes):
return list(o)
return json.JSONEncoder.default(self, o)
chat = pytchat.create(video_id="coYw-eVU0Ks")
while chat.is_alive():
#msg = chat.get().json()
'''with open('E:/Games/cgi-bin/messages_yt.json', 'w') as outfile:
json.dump(msg, outfile, cls=DateTimeEncoder)
break'''
time.sleep(2)
for c in chat.get().items:
#print(c.json())
print(c.author.name + ': ' + c.message)
'''
# Each chat item can also be output in JSON format.
for c in chat.get().items:
print(c.json())
'''