<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.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://lms.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://lms.onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_ASCII.py&amp;action=history"/>
	<updated>2026-04-28T01:55:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.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__ = &#039;seandolinar&#039;    import json  import csv    &#039;&#039;&#039;  creates a .csv file using a Twitter .json file  the fields have to be set manually  &#039;&#039;&#039;    data_json = open(&#039;raw...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.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__ = &amp;#039;seandolinar&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 import json&lt;br /&gt;
 import csv&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;&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;
 &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 data_json = open(&amp;#039;raw_tweets.json&amp;#039;, mode=&amp;#039;r&amp;#039;).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(&amp;#039;tweets_out_ASCII.csv&amp;#039;, mode=&amp;#039;w&amp;#039;) #opens csv file&lt;br /&gt;
 writer = csv.writer(csv_out) #create the csv writer object &lt;br /&gt;
 &lt;br /&gt;
 fields = [&amp;#039;created_at&amp;#039;, &amp;#039;text&amp;#039;, &amp;#039;screen_name&amp;#039;, &amp;#039;followers&amp;#039;, &amp;#039;friends&amp;#039;, &amp;#039;rt&amp;#039;, &amp;#039;fav&amp;#039;] #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(&amp;#039;created_at&amp;#039;),&lt;br /&gt;
                      line.get(&amp;#039;text&amp;#039;).encode(&amp;#039;unicode_escape&amp;#039;), #unicode escape to fix emoji issue&lt;br /&gt;
                      line.get(&amp;#039;user&amp;#039;).get(&amp;#039;screen_name&amp;#039;),&lt;br /&gt;
                      line.get(&amp;#039;user&amp;#039;).get(&amp;#039;followers_count&amp;#039;),&lt;br /&gt;
                      line.get(&amp;#039;user&amp;#039;).get(&amp;#039;friends_count&amp;#039;),&lt;br /&gt;
                      line.get(&amp;#039;retweet_count&amp;#039;),&lt;br /&gt;
                      line.get(&amp;#039;favorite_count&amp;#039;)])&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>