<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Twitter_JSONParser_ASCII.py</id>
	<title>Twitter JSONParser ASCII.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Twitter_JSONParser_ASCII.py"/>
	<link rel="alternate" type="text/html" href="https://onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_ASCII.py&amp;action=history"/>
	<updated>2026-05-05T03:08:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.4</generator>
	<entry>
		<id>https://onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_ASCII.py&amp;diff=46710&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot; __author__ = 'seandolinar'    import json  import csv    '''  creates a .csv file using a Twitter .json file  the fields have to be set manually  '''    data_json = open('raw...&quot;</title>
		<link rel="alternate" type="text/html" href="https://onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_ASCII.py&amp;diff=46710&amp;oldid=prev"/>
		<updated>2017-01-28T03:57:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; __author__ = &amp;#039;seandolinar&amp;#039;    import json  import csv    &amp;#039;&amp;#039;&amp;#039;  creates a .csv file using a Twitter .json file  the fields have to be set manually  &amp;#039;&amp;#039;&amp;#039;    data_json = open(&amp;#039;raw...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; __author__ = 'seandolinar'&lt;br /&gt;
 &lt;br /&gt;
 import json&lt;br /&gt;
 import csv&lt;br /&gt;
 &lt;br /&gt;
 '''&lt;br /&gt;
 creates a .csv file using a Twitter .json file&lt;br /&gt;
 the fields have to be set manually&lt;br /&gt;
 '''&lt;br /&gt;
 &lt;br /&gt;
 data_json = open('raw_tweets.json', mode='r').read() #reads in the JSON file into Python as a string&lt;br /&gt;
 data_python = json.loads(data_json) #turns the string into a json Python object&lt;br /&gt;
 &lt;br /&gt;
 csv_out = open('tweets_out_ASCII.csv', mode='w') #opens csv file&lt;br /&gt;
 writer = csv.writer(csv_out) #create the csv writer object &lt;br /&gt;
 &lt;br /&gt;
 fields = ['created_at', 'text', 'screen_name', 'followers', 'friends', 'rt', 'fav'] #field names&lt;br /&gt;
 writer.writerow(fields) #writes field&lt;br /&gt;
 &lt;br /&gt;
 for line in data_python:&lt;br /&gt;
 &lt;br /&gt;
     #writes a row and gets the fields from the json object&lt;br /&gt;
     #screen_name and followers/friends are found on the second level hence two get methods&lt;br /&gt;
     writer.writerow([line.get('created_at'),&lt;br /&gt;
                      line.get('text').encode('unicode_escape'), #unicode escape to fix emoji issue&lt;br /&gt;
                      line.get('user').get('screen_name'),&lt;br /&gt;
                      line.get('user').get('followers_count'),&lt;br /&gt;
                      line.get('user').get('friends_count'),&lt;br /&gt;
                      line.get('retweet_count'),&lt;br /&gt;
                      line.get('favorite_count')])&lt;br /&gt;
 &lt;br /&gt;
 csv_out.close()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Referensi==&lt;br /&gt;
&lt;br /&gt;
* https://raw.githubusercontent.com/seandolinar/Twitter-Tutorial/master/twitter_JSONParser_ASCII.py&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>