<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>140dev &#187; Twitter Politics</title>
	<atom:link href="http://140dev.com/twitter-api-programming-blog/category/twitter_politics/feed/" rel="self" type="application/rss+xml" />
	<link>http://140dev.com</link>
	<description>Twitter API Programming Tips, Tutorials, Source Code Libraries and Consulting</description>
	<lastBuildDate>Wed, 31 Jul 2019 10:03:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>Aligning our Twitter code with our politics: UniteBlue.com</title>
		<link>http://140dev.com/twitter-api-programming-blog/aligning-our-twitter-code-with-our-politics-uniteblue-com/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/aligning-our-twitter-code-with-our-politics-uniteblue-com/#comments</comments>
		<pubDate>Wed, 12 Sep 2012 14:23:03 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Engagement Campaign]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1782</guid>
		<description><![CDATA[For the last couple of years we&#8217;ve been helping clients with a wide range of Twitter engagement tools. We&#8217;ve helped non-profits, political campaigns, and businesses identify and engage with the best Twitter accounts to help spread their message. Now we&#8217;ve committed our efforts to a free site that helps progressives unite for political action. UniteBlue.com [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>For the last couple of years we&#8217;ve been helping clients with a wide range of Twitter engagement tools. We&#8217;ve helped non-profits, political campaigns, and businesses identify and engage with the best Twitter accounts to help spread their message. Now we&#8217;ve committed our efforts to a free site that helps progressives unite for political action. <a href="http://uniteblue.com">UniteBlue.com</a> combines a great set of Twitter accounts on the left with the same type of engagement tools we&#8217;ve perfected in our client work. Our first <a href=" http://www.prweb.com/releases/2012/9/prweb9887113.htm">press release</a> on the site has the details. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/aligning-our-twitter-code-with-our-politics-uniteblue-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with tweet bursts</title>
		<link>http://140dev.com/twitter-api-programming-blog/dealing-with-tweet-bursts/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/dealing-with-tweet-bursts/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 14:11:25 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Database Cache]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[Tweet Aggregation]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1309</guid>
		<description><![CDATA[This week we got crushed by the State of the Union speech. We normally get about 30,000 to 50,000 tweets per day in the 2012twit.com database, and our largest server can handle that without any showing any appreciable load. During the SOTU tweet volume exploded. We got 500,000 tweets in about 4 hours. I was [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>This week we got crushed by the State of the Union speech. We normally get about 30,000 to 50,000 tweets per day in the <a href="http://2012twit.com">2012twit.com</a> database, and our largest server can handle that without any showing any appreciable load. During the SOTU tweet volume exploded. We got 500,000 tweets in about 4 hours. I was able to keep the server going by shutting down some processes that weren&#8217;t needed, but it was a challenge. This issue of bursts of tweets seems to be getting worse. In the case of Twitter and politics people are getting used to talking back to the TV through Twitter. With 9 months left until the election I needed to find some solutions. </p>
<p>I spent a lot of time over the last 2 days trying to find the problem, and discovered that it was not parsing the tweets that was killing us, but inserting the raw tweet data into the json_cache table. I use a <a href="http://140dev.com/twitter-api-programming-tutorials/twitter-api-database-cache/">two phase processing system</a> with the raw tweet delivered by the streaming API getting inserted as fast as possible in a cache table, and then a separate parsing phase breaking it out into a normalized schema. You can get the <a href="http://140dev.com/free-twitter-api-source-code-library/">basic code</a> for this as open source. </p>
<p>It looks like Twitter has been steadily increasing the size of the basic payload that it sends for each tweet in the streaming API. That makes sense, since people are demanding more data. Yesterday they announced some insane scheme where every tweet will include data about countries that don&#8217;t want tweets with specific words to be displayed. This will only get worse.</p>
<p>I realized that I have never actually needed to go back and reparse the contents of json_cache, and I had long ago added purging code to my 2012twit system to delete anything in that table older than 7 days. I tried clearing out the json_cache table on my server and modifying the code to delete each tweet as soon as it was parsed. This cut the size from several hundred thousand rows on average in this table to about 50. The load on that server dropped right away and during the GOP debate last night, the load stayed very low. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/dealing-with-tweet-bursts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collecting #OWS tweets with the 140dev framework</title>
		<link>http://140dev.com/twitter-api-programming-blog/collecting-ows-tweets-with-the-140dev-framework/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/collecting-ows-tweets-with-the-140dev-framework/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:25:56 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[140dev Source Code]]></category>
		<category><![CDATA[Tweet Aggregation]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1223</guid>
		<description><![CDATA[Our work with Twitter and politics has now moved beyond the 2012 election. We just set up a tweet collection database to track the Occupy Wall Street movement. It uses the 140dev framework to collect all tweets containing #ows, #occupy, and #occupywalllstreet. This will be used to document our tools and methodology to automate a [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>Our work with Twitter and politics has now moved beyond the 2012 election. We just set up a <a href="http://ows.140elect.com/tweet_stats.php">tweet collection database</a> to track the Occupy Wall Street movement. It uses the 140dev framework to collect all tweets containing #ows, #occupy, and #occupywalllstreet. </p>
<p><img src="http://140dev.com/blog_images/ows.png"> </p>
<p>This will be used to document our tools and methodology to automate a Twitter engagement campaign. In this case we&#8217;ll be building up a new political account we started called <a href="http://twitter.com/4more">@4more</a>. You can follow this work on our <a href="http://140elect.com/2012-analysis/tweet-collection-database-for-4more-engagement/">140elect.com</a> blog. </p>
<p>Update, 1/21/12: The tweet flow for #OWS has dwindled down to a point where it isn&#8217;t worth tracking, so we&#8217;ve turned this system off for now. Hopefully the Occupy movement will become active again in the spring. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/collecting-ows-tweets-with-the-140dev-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Primer for Automated Twitter Engagement</title>
		<link>http://140dev.com/twitter-api-programming-blog/primer-for-automated-twitter-engagement/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/primer-for-automated-twitter-engagement/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 04:31:55 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Engagement Campaign]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1220</guid>
		<description><![CDATA[A lot of my Twitter consulting for clients has involved automating the process of Twitter engagement. Now I&#8217;m finally documenting this as part of the Twitter politics work I&#8217;m doing with my son. We are building up a political account called @4more, and writing up the whole process on our 140elect.com blog.]]></description>
				<content:encoded><![CDATA[<p></p><p>A lot of my Twitter consulting for clients has involved automating the process of Twitter engagement. Now I&#8217;m finally documenting this as part of the Twitter politics work I&#8217;m doing with my son. We are building up a political account called <a href="http://twitter.com/4more">@4more</a>, and writing up the whole process on our <a href="http://140elect.com/election-analysis/twitter-engagement-campaign/">140elect.com blog</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/primer-for-automated-twitter-engagement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2012twit.com has launched</title>
		<link>http://140dev.com/twitter-api-programming-blog/2012twit-com-has-launched/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/2012twit-com-has-launched/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 13:25:28 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1185</guid>
		<description><![CDATA[I&#8217;ve been quiet here for the last couple of months as I&#8217;ve worked on a new Twitter dashboard for the 2012 presidential election. We launched it last night at http://2012twit.com, and I&#8217;m very pleased with the result. This will be a lot of fun. I&#8217;ll be blogging here about development issues related to the site. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;ve been quiet here for the last couple of months as I&#8217;ve worked on a new Twitter dashboard for the 2012 presidential election. We launched it last night at <a href="http://2012twit.com">http://2012twit.com</a>, and I&#8217;m very pleased with the result. This will be a lot of fun. I&#8217;ll be blogging here about development issues related to the site. </p>
<p>The next big step will be adding full Twitter client capability to the site: account login, tweeting, following, etc. I want to build an open source module for these features that I can add to the <a href="http://140dev.com/free-twitter-api-source-code-library/">140dev framework</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/2012twit-com-has-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic restarting of stream connection</title>
		<link>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 03:30:33 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Phirehose]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1181</guid>
		<description><![CDATA[The 2012 candidate system is going to need a more fault tolerant collection system. Since the Egyptian protest started Twitter has been even more unreliable, and this is affecting the connection to the streaming API. I use a monitoring system to warn me when tweet collection has stopped, but it hasn&#8217;t been necessary in the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>The 2012 candidate system is going to need a more fault tolerant collection system. Since the Egyptian protest started Twitter has been even more unreliable, and this is affecting the connection to the streaming API. I use a monitoring system to warn me when tweet collection has stopped, but it hasn&#8217;t been necessary in the past to automatically restart the connection. I saw some communication about this on the Phirehose mailing list. I need to run the collection script and capture the process id. Then kill the process with the same id and restart it when no new tweets are received for 10 minutes. </p>
<p>Update: This was pretty easy. I can add this code to the collection script to have it write it&#8217;s process id to a text file when it starts:<br />
<code>$fp = fopen('process_id.txt','w');<br />
fwrite($fp,getmypid());<br />
fclose($fp);</code></p>
<p>Then I can modify the monitoring script to kill the current collection script when no tweets are added for 10 minutes, and then restart it:<br />
<code>$process_id = file_get_contents('process_id.txt');<br />
exec('kill -9 ' . $process_id);<br />
exec('nohup php get_tweets.php > /dev/null &#038;');</code></p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/automatic-restarting-of-stream-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overcoming 502 errrors while backfilling tweets</title>
		<link>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 13:15:55 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Rate Limits]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[Twitter Politics]]></category>
		<category><![CDATA[Twitter Server Errors]]></category>
		<category><![CDATA[2012 candidates]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1178</guid>
		<description><![CDATA[I&#8217;m collecting all the tweets for possible 2012 candidates with the Streaming API, and I wanted to make sure I was getting every one of their tweets. I built a backfilling script to go through every tweet in each of these accounts, and add any that weren&#8217;t already in the database. This uses the /statuses/user_timeline [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;m collecting all the tweets for possible 2012 candidates with the Streaming API, and I wanted to make sure I was getting every one of their tweets. I built a backfilling script to go through every tweet in each of these accounts, and add any that weren&#8217;t already in the database. This uses the <a href="http://dev.twitter.com/doc/get/statuses/user_timeline">/statuses/user_timeline</a> call to get the past tweets. I ran into a problem with tons of 502 errors from the Twitter API, as many as one every two or three API calls. </p>
<p>Taylor Singletary on the Dev mailing list suggested dropping the count parameter to avoid timeout errors, and this has helped a lot. I was using a count of 200 tweets per call to keep the number of calls low. This gave me all the data in about 100 calls, but with the errors I wasn&#8217;t able to complete the process before hitting the rate limit. I tried dropping the count to 100, and this allowed the script to finish with a total of 298 calls. </p>
<p>So now I have the catch 22 of needing to do more API calls to avoid the errors that cause too many API calls. The only solution I see is to cut the count parameter to a level that is low enough to avoid errors, and then spread the backfilling out over multiple hours to stay within the rate limit. </p>
<p>I think the ultimate solution is to do a steady level of backfilling spread over the entire day. I haven&#8217;t had to do backfilling in the past, because I was treating the Streaming API tweet collection as a high volume sampling mechanism. As long as I got lots of tweets on a particular subject, it was good. Now that I want to maintain a database of every tweet made by the candidates I have to backfill to make sure nothing was missed by streaming. This seems to be necessary, since every time I run the backfill I get two to three tweets that didn&#8217;t get sent by streaming. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Politics: Collecting tweets for potential 2012 candidates</title>
		<link>http://140dev.com/twitter-api-programming-blog/twitter-politics-collecting-tweets-for-potential-2012-candidates/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/twitter-politics-collecting-tweets-for-potential-2012-candidates/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 12:54:12 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1174</guid>
		<description><![CDATA[I&#8217;ve built a tweet aggregation database for the 2012 election, and I&#8217;m using the streaming API to collect all tweets for the possible candidates. I want to go a lot further than just collecting their tweets, though. I think there will be all kinds of fascinating data to mine from the way these Twitter accounts [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;ve built a tweet aggregation database for the 2012 election, and I&#8217;m using the streaming API to collect all tweets for the possible candidates. I want to go a lot further than just collecting their tweets, though. I think there will be all kinds of fascinating data to mine from the way these Twitter accounts develop over the next two years. How fast are they gathering followers, what tags do they use, how many people mention them? Right now I&#8217;m doing basic research, but I think this could justify an entire site. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/twitter-politics-collecting-tweets-for-potential-2012-candidates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Politics: Who gets to regulate Twitter?</title>
		<link>http://140dev.com/twitter-api-programming-blog/twitter-politics-who-gets-to-regulate-twitter/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/twitter-politics-who-gets-to-regulate-twitter/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 12:48:50 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1167</guid>
		<description><![CDATA[Two groups on Twitter that have been ignoring each other are about to collide, and it won&#8217;t be pretty when they do. Politicians from world Presidents to American Congressmen have embraced Twitter over the last year, and now hacktivists are using Twitter to manage and promote the Wikileaks cyberwar. They are operating side by side, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>Two groups on Twitter that have been ignoring each other are about to collide, and it won&#8217;t be pretty when they do. Politicians from <a href="http://140dev.com/twitter-api-programming-blog/this-is-what-twitter-is/">world Presidents</a> to <a href="http://140dev.com/twitter-api-programming-blog/twitter-politics-screen-name-shuffle/">American Congressmen</a> have embraced Twitter over the last year, and now hacktivists are using Twitter to manage and promote the Wikileaks cyberwar. They are operating side by side, and it is only a matter of time that the hacktivists turn on the politicians. Twitter is known as being easy to hack, with <a href="http://140dev.com/twitter-api-programming-blog/is-twitter-terrorism-next/">false Tsunami reports</a> in Indonesia as a recent example. </p>
<p>What happens when the hacktivists turn on the politicians directly and threaten to continually disrupt and take over the accounts of world leaders? What will the world do? Will the FCC be given control over Twitter, since it is a US company? Will UN resolutions try to control it? The WikiWar is fundamentally about communication and its use as a political tool/weapon. This is the logical progression from tweeting during the Iraq elections and using it to manage student protests in the UK. The bomb throwers and terrorists are next, and there are highly vulnerable targets on Twitter. </p>
<p>Politicians overreact when threatened. Their next threat will come from Twitter. This is going to get ugly. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/twitter-politics-who-gets-to-regulate-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is what Twitter is</title>
		<link>http://140dev.com/twitter-api-programming-blog/this-is-what-twitter-is/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/this-is-what-twitter-is/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 02:32:11 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Twitter Politics]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1131</guid>
		<description><![CDATA[I&#8217;m saving this tweet from Russian President Medvedev so I can point to it the next time I read an article pontificating on what Twitter should become. Twitter doesn&#8217;t have to become anything, it already is. Twitter is a tool that lets the President of Russia cut through any filters and communicate with anyone he [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p style="text-align: center;"><a href="http://twitter.com/MedvedevRussiaE/statuses/10368140965838848"><img class="aligncenter" style="border: 1px solid black;" src="http://140dev.com/blog_images/medvedev_tweet.png" border="1" alt="" width="531" height="285" /></a></p>
<p style="text-align: left;"><a href="http://twitter.com/MedvedevRussiaE/statuses/10368140965838848"></a>I&#8217;m saving this tweet from Russian President Medvedev so I can point to it the next time I read an article pontificating on what Twitter should become. Twitter doesn&#8217;t have to become anything, it already is. Twitter is a tool that lets the President of Russia cut through any filters and communicate with anyone he wants in a form that can be passed on to anyone else. I think that&#8217;s enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/this-is-what-twitter-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
