This commit is contained in:
sShemet
2025-12-22 14:03:10 +05:00
commit ade2833df7
74 changed files with 42924 additions and 0 deletions

32
govno/yt.py Normal file
View File

@@ -0,0 +1,32 @@
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())
'''