#!/usr/bin/env python

"""Example usage: reddit_users.py pics fffffffuuuuuuuuuuuu funny"""

from scrape import *
import sys, time

row = ['%04d-%02d-%02d %02d:%02d' % time.gmtime()[:5]]
for r in sys.argv[1:]:
    s = Session()
    d = s.go('http://www.reddit.com/r/' + r)
    u = d.first(class_=regex('users-online'))
    n = u.first(class_=regex('number')).text.replace(',', '')
    row.append(n)

print '\t'.join(row)
