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}")
Im using this one pytchat script to fetch youtube live chat. Usually its working fine but sometimes i got an error:
Traceback (most recent call last):
File "pytchat.py", line 14, in <module>
for c in chat.get().sync_items():
AttributeError: 'list' object has no attribute 'sync_items'
After that its stop working and i need to restart it manually.
Any idea how could i solve this issue? Maybe some kind of auto restart if there is no better option?