Home - PetterKraabol/Twitch-Python GitHub Wiki

Twitch Python takes a neat object-oriented approach to access Twitch services.

pip install twitch-python

import twitch

# Twitch API

# Helix API with caching enabled
helix = twitch.Helix('client-id', use_cache=True)

for user, videos in helix.users(['sodapoppin', 'reckful']).videos(first=5):
    for video, comments in videos.comments():
        for comment in comments:
            print(comment.commenter.display_name, comment.message.body)


# Twitch Chat

twitch.Chat(channel='#reckful', nickname='zarlach', oauth='oauth:xxxxxx').subscribe(
        lambda message: print(message.channel, message.sender, message.text))