<?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_UTF8.py</id>
	<title>Twitter JSONParser UTF8.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_UTF8.py"/>
	<link rel="alternate" type="text/html" href="https://onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_UTF8.py&amp;action=history"/>
	<updated>2026-05-08T03:31:20Z</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_UTF8.py&amp;diff=46716&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot; __author__ = 'seandolinar'    import json  import csv  import io    '''  creates a .csv file using a Twitter .json file  the fields have to be set manually  '''    data_json...&quot;</title>
		<link rel="alternate" type="text/html" href="https://onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_UTF8.py&amp;diff=46716&amp;oldid=prev"/>
		<updated>2017-01-28T04:12:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; __author__ = &amp;#039;seandolinar&amp;#039;    import json  import csv  import io    &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...&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;
 import io&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 = io.open('raw_tweets.json', mode='r', encoding='utf-8').read() #reads in the JSON file&lt;br /&gt;
 data_python = json.loads(data_json)&lt;br /&gt;
 &lt;br /&gt;
 csv_out = io.open('tweets_out_utf8.csv', mode='w', encoding='utf-8') #opens csv file&lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
 fields = u'created_at,text,screen_name,followers,friends,rt,fav' #field names&lt;br /&gt;
 csv_out.write(fields)&lt;br /&gt;
 csv_out.write(u'\n')&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;
     row = [line.get('created_at'),&lt;br /&gt;
            '&amp;quot;' + line.get('text').replace('&amp;quot;','&amp;quot;&amp;quot;') + '&amp;quot;', #creates double quotes&lt;br /&gt;
            line.get('user').get('screen_name'),&lt;br /&gt;
            unicode(line.get('user').get('followers_count')),&lt;br /&gt;
            unicode(line.get('user').get('friends_count')),&lt;br /&gt;
            unicode(line.get('retweet_count')),&lt;br /&gt;
            unicode(line.get('favorite_count'))] &lt;br /&gt;
 &lt;br /&gt;
     row_joined = u','.join(row)&lt;br /&gt;
     csv_out.write(row_joined)&lt;br /&gt;
     csv_out.write(u'\n')&lt;br /&gt;
 &lt;br /&gt;
 csv_out.close()&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_UTF8.py&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>