Skip to content

Instantly share code, notes, and snippets.

@jtg567
Created December 2, 2015 05:08
Show Gist options
  • Save jtg567/2fb7b801095cd264d2eb to your computer and use it in GitHub Desktop.
Save jtg567/2fb7b801095cd264d2eb to your computer and use it in GitHub Desktop.
Use the twitch.tv API with python to see if a particular channel is streaming (python-twitch)
from twitch.api.v3 import streams
# check stream w/twitch api https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel
check = streams.by_channel('<replace channel name>')
# if stream None (not live) then type == dict is False (otherwise True when live)
air_status = type(check['stream']) == dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment