suitegamer suitegamer - 3 months ago 37
Python Question

Is There Any Way To Check if a Twitch Stream Is Live Using Python?

I'm just wondering if there is any way to write a python script to check to see if a stream is live? Any and all thoughts are appreciated!

EDIT: I'm not sure why my app engine tag was removed, but this would be using app engine.


It looks like Twitch provides an API (documentation here) that provides a way to get that info. A very simple example of getting the feed would be:

import urllib2

url = ''
contents = urllib2.urlopen(url)


This will dump all of the info, which you can then parse with a JSON library (XML looks to be available too). Looks like the value returns empty if the stream isn't live (haven't tested this much at all, nor have I read anything :) ). Hope this helps!