Skip to content

Instantly share code, notes, and snippets.

@bobpoekert
Created May 13, 2011 06:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobpoekert/970101 to your computer and use it in GitHub Desktop.
Save bobpoekert/970101 to your computer and use it in GitHub Desktop.
stream count
from twisted.web.client import getPage
import json
@after(getPage, key=lambda channel: "http://api.justin.tv/api/stream/list.json?channel=%s" % channel)
def viewer_count(response, channel):
data = json.loads(response)
return data[0]['stream_count']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment