Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

CompatibleProcessor

taizan-hokuto edited this page Nov 3, 2020 · 3 revisions
  • the chat processor compatible with the structures that YT API returns.

Example Code

from pytchat import LiveChat, CompatibleProcessor
import time

chat = LiveChat("uIx8l2xlYVY", 
  processor = CompatibleProcessor() )

while chat.is_alive():
  try:
    data = chat.get()
    polling = data['pollingIntervalMillis']/1000
    for c in data['items']:
      if c.get('snippet'):
        print(f"[{c['authorDetails']['displayName']}]"
              f"-{c['snippet']['displayMessage']}")
        time.sleep(polling/len(data['items']))
  except KeyboardInterrupt:
    chat.terminate()
Clone this wiki locally