User:Natasa Siencnik/project2

From XPUB & Lens-Based wiki


Rumor of Revolution

Web crawler searching Twitter for a Revolution

1 - Description


2 - Flowchart

3 - Script

#!//usr/bin/python

import urllib2, json, sys
#from apikey import apikey

#api = twitter.Api(username=username, password=password)
url = 'http://search.twitter.com/search.json?q=%23revolution'
f = urllib2.urlopen(url)
data = json.load(f)
 
for r in data['results']:
#    print r['created_at'] + r['from_user'] + ' : "' + r['text'] + '"'
    sys.stdout.write r['created_at'] + r['from_user'] + ' : "' + r['text'] + '"'


4 - Outcome


5 - Questions

  • parsing