<?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_UTF8.py</id>
	<title>Twitter JSONParser UTF8.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_UTF8.py"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Twitter_JSONParser_UTF8.py&amp;action=history"/>
	<updated>2026-04-20T02:45:06Z</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_UTF8.py&amp;diff=46716&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot; __author__ = &#039;seandolinar&#039;    import json  import csv  import io    &#039;&#039;&#039;  creates a .csv file using a Twitter .json file  the fields have to be set manually  &#039;&#039;&#039;    data_json...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.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__ = &amp;#039;seandolinar&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 import json&lt;br /&gt;
 import csv&lt;br /&gt;
 import io&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 = io.open(&amp;#039;raw_tweets.json&amp;#039;, mode=&amp;#039;r&amp;#039;, encoding=&amp;#039;utf-8&amp;#039;).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(&amp;#039;tweets_out_utf8.csv&amp;#039;, mode=&amp;#039;w&amp;#039;, encoding=&amp;#039;utf-8&amp;#039;) #opens csv file&lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
 fields = u&amp;#039;created_at,text,screen_name,followers,friends,rt,fav&amp;#039; #field names&lt;br /&gt;
 csv_out.write(fields)&lt;br /&gt;
 csv_out.write(u&amp;#039;\n&amp;#039;)&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(&amp;#039;created_at&amp;#039;),&lt;br /&gt;
            &amp;#039;&amp;quot;&amp;#039; + line.get(&amp;#039;text&amp;#039;).replace(&amp;#039;&amp;quot;&amp;#039;,&amp;#039;&amp;quot;&amp;quot;&amp;#039;) + &amp;#039;&amp;quot;&amp;#039;, #creates double quotes&lt;br /&gt;
            line.get(&amp;#039;user&amp;#039;).get(&amp;#039;screen_name&amp;#039;),&lt;br /&gt;
            unicode(line.get(&amp;#039;user&amp;#039;).get(&amp;#039;followers_count&amp;#039;)),&lt;br /&gt;
            unicode(line.get(&amp;#039;user&amp;#039;).get(&amp;#039;friends_count&amp;#039;)),&lt;br /&gt;
            unicode(line.get(&amp;#039;retweet_count&amp;#039;)),&lt;br /&gt;
            unicode(line.get(&amp;#039;favorite_count&amp;#039;))] &lt;br /&gt;
 &lt;br /&gt;
     row_joined = u&amp;#039;,&amp;#039;.join(row)&lt;br /&gt;
     csv_out.write(row_joined)&lt;br /&gt;
     csv_out.write(u&amp;#039;\n&amp;#039;)&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>