User:Natasa Siencnik/project2: Difference between revisions
From XPUB & Lens-Based wiki
|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
| [[Category:Prototyping]]
| |
|
| |
|
| [[category:2011 P1.02]]
| |
|
| |
| == Rumor of Revolution ==
| |
| Web crawler searching Twitter for a <i>Revolution</i>
| |
| <br />
| |
| <br />
| |
|
| |
| '''1 - Description''' <br />
| |
|
| |
|
| |
| '''2 - Flowchart'''<br />
| |
|
| |
| '''3 - Script'''<br />
| |
|
| |
| <source lang="php">
| |
| #!//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'] + '"'
| |
|
| |
| </source>
| |
|
| |
|
| |
|
| |
| '''4 - Outcome'''<br />
| |
|
| |
|
| |
| '''5 - Questions'''<br />
| |
| * parsing
| |
Latest revision as of 14:55, 8 June 2011