User:Natasa Siencnik/workshop1: Difference between revisions
(Created page with "Category:Prototyping category:2011 P1.02 == Rumor of Revolution == Web crawler searching Twitter for a <i>Revolution</i> <br /> <br /> '''1 - Description''' <br /> '...") |
No edit summary |
||
Line 18: | Line 18: | ||
#!//usr/bin/python | #!//usr/bin/python | ||
import urllib2, json, sys | import urllib2, json, sys, codecs | ||
url = 'http://search.twitter.com/search.json?q=%23revolution' | url = 'http://search.twitter.com/search.json?q=%23revolution' | ||
f = urllib2.urlopen(url) | f = urllib2.urlopen(url) | ||
data = json.load(f) | data = json.load(f) | ||
for | output = codecs.open("output.txt", "w", encoding='utf-8') | ||
for entry in data['results']: | |||
line = entry['created_at'] + ' : ' + entry['text'] | |||
output.write(line) | |||
output.write('\n') | |||
</source> | </source> | ||
'''4 - Languages'''<br /> | |||
Afriaans: Rewolusie | |||
Albanian: Revolucion | |||
Arabic: الثورة | |||
Armenian: Հեղափոխություն | |||
Azerbaijjani: Inqilab | |||
Basque: Iraultza | |||
Belarusian: Рэвалюцыі | |||
Bulgarian: Революция | |||
Catalan: Revolució | |||
Chinese: 革命 | |||
Croatian: Revolucija | |||
Czech: Revoluce | |||
Danish: Revolution | |||
Dutch: Revolutie | |||
English: Revolution | |||
Estonian: Revolutsioon | |||
Filipino: Rebolusyon | |||
Finnish: Vallankumous | |||
French: Révolution | |||
Galician: Revolución | |||
Georgian: რევოლუცია | |||
German: Revolution | |||
GreeK: Επανάσταση | |||
Haitian: Revolisyon | |||
Hebrew: מהפכה | |||
Hindi: क्रांति | |||
Hungarian: Forradalom | |||
Icelanding: Revolution | |||
Indonasian: Revolusi | |||
Irish: Réabhlóid | |||
Italian: Rivoluzione | |||
Japanese: 革命 | |||
Korean: 혁명 | |||
Latvian: Revolūcija | |||
Lithuanian: Revoliucija | |||
Macedonian: Револуција | |||
Malay: Revolusi | |||
Maltese: Rivoluzzjoni | |||
Norvegian: Revolution | |||
Persian: انقلاب | |||
Polish: Rewolucji | |||
Portuguese: Revolução | |||
Romanian: Revoluţie | |||
Russian: Революции | |||
Serbian: Револуција | |||
Slovak: Revolúcia | |||
Slovenian: Revolucija | |||
Spanish: Revolución | |||
Swahili: Mapinduzi | |||
Swedish: Revolution | |||
Tagalog: Rebolusyon | |||
Thai: การปฏิวัติ | |||
Turkish: Devrim | |||
Ukrainian: Революції | |||
Urdu: انقلاب | |||
Vietnamese: Cách mạng | |||
Welsh: Chwyldro | |||
Jiddish: רעוואָלוציע | |||
'' | ''45 - Outcome'''<br /> | ||
''' | '''6 - Questions'''<br /> | ||
* parsing | * parsing |
Revision as of 19:58, 24 January 2011
Rumor of Revolution
Web crawler searching Twitter for a Revolution
1 - Description
2 - Flowchart
3 - Script
#!//usr/bin/python
import urllib2, json, sys, codecs
url = 'http://search.twitter.com/search.json?q=%23revolution'
f = urllib2.urlopen(url)
data = json.load(f)
output = codecs.open("output.txt", "w", encoding='utf-8')
for entry in data['results']:
line = entry['created_at'] + ' : ' + entry['text']
output.write(line)
output.write('\n')
4 - Languages
Afriaans: Rewolusie Albanian: Revolucion Arabic: الثورة Armenian: Հեղափոխություն Azerbaijjani: Inqilab Basque: Iraultza Belarusian: Рэвалюцыі Bulgarian: Революция Catalan: Revolució Chinese: 革命 Croatian: Revolucija Czech: Revoluce Danish: Revolution Dutch: Revolutie English: Revolution Estonian: Revolutsioon Filipino: Rebolusyon Finnish: Vallankumous French: Révolution Galician: Revolución Georgian: რევოლუცია German: Revolution GreeK: Επανάσταση Haitian: Revolisyon Hebrew: מהפכה Hindi: क्रांति Hungarian: Forradalom Icelanding: Revolution Indonasian: Revolusi Irish: Réabhlóid Italian: Rivoluzione Japanese: 革命 Korean: 혁명 Latvian: Revolūcija Lithuanian: Revoliucija Macedonian: Револуција Malay: Revolusi Maltese: Rivoluzzjoni Norvegian: Revolution Persian: انقلاب Polish: Rewolucji Portuguese: Revolução Romanian: Revoluţie Russian: Революции Serbian: Револуција Slovak: Revolúcia Slovenian: Revolucija Spanish: Revolución Swahili: Mapinduzi Swedish: Revolution Tagalog: Rebolusyon Thai: การปฏิวัติ Turkish: Devrim Ukrainian: Революції Urdu: انقلاب Vietnamese: Cách mạng Welsh: Chwyldro Jiddish: רעוואָלוציע
45 - Outcome'
6 - Questions
- parsing