User:Laura Macchini/prototyping/iamsoglad
< User:Laura Macchini
Revision as of 23:24, 18 October 2010 by Laura Macchini (talk | contribs)
I am so glad I don't have school today :)
Description
The theme of this prototype is the "affirmation of self". I download the rss feed from the search function on twitter, using "I am" as a keyword, and I save the result in a textfile, so that everytime I launch my script I obtain the real-time result of the self-affirmation on twitter.
Workflow
- the script downloads the twitter rss feed for the search "I am"
- I launch a sed script on the downloaded file, in order to clean up everything that's not the tweet itself, and save it again.
- I concatenate the newest results with the old ones
- at this point I save the resulting text into a wavefile via text2wave
- for the sake of the rap I play the wave file along with a base song :)
Input example
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/"i am"</id>
<link type="text/html" href="http://search.twitter.com/search?q=%22i+am%22" rel="alternate"/>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?q=%22i+am%22" rel="self"/>
<title>"i am" - Twitter Search</title>
<link type="application/opensearchdescription+xml" href="http://search.twitter.com/opensearch.xml" rel="search"/>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?q=%22i+am%22&since_id=27739161425" rel="refresh"/>
<twitter:warning>since_id removed for pagination.</twitter:warning>
<updated>2010-10-18T14:25:42Z</updated>
<openSearch:itemsPerPage>15</openSearch:itemsPerPage>
<link type="application/atom+xml" href="http://search.twitter.com/search.atom?max_id=27739161425&page=2&q=%22i+am%22" rel="next"/>
<entry>
<id>tag:search.twitter.com,2005:27739161425</id>
<published>2010-10-18T14:25:42Z</published>
<link type="text/html" href="http://twitter.com/_HighAceZ/statuses/27739161425" rel="alternate"/>
<title>@MAKEitWET_JAN25 shit u not like me i just act like no one is here waste yo energy muthafucka lol i know u there lol yup i am but no answer</title>
<content type="html"><a href="http://twitter.com/MAKEitWET_JAN25">@MAKEitWET_JAN25</a> shit u not like me i just act like no one is here waste yo energy muthafucka lol i know u there lol yup <b>i am</b> but no answer</content>
<updated>2010-10-18T14:25:42Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/1128483332/Image43_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>_HighAceZ (JustCallMe Ace)</name>
<uri>http://twitter.com/_HighAceZ</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739160977</id>
<published>2010-10-18T14:25:42Z</published>
<link type="text/html" href="http://twitter.com/PinkSith/statuses/27739160977" rel="alternate"/>
<title>@MUWithdrawal Thanks honey. I am feeling much better. Back to my regular bile filled self!</title>
<content type="html"><a href="http://twitter.com/MUWithdrawal">@MUWithdrawal</a> Thanks honey. <b>I am</b> feeling much better. Back to my regular bile filled self!</content>
<updated>2010-10-18T14:25:42Z</updated>
<link type="image/png" href="http://a1.twimg.com/profile_images/626430377/pinksithlogo_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>PinkSith (Pink Sith)</name>
<uri>http://twitter.com/PinkSith</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739160500</id>
<published>2010-10-18T14:25:42Z</published>
<link type="text/html" href="http://twitter.com/AkifKeith/statuses/27739160500" rel="alternate"/>
<title>So,I Am Anxious About Tomorrow.I felt like shitting for a moment,the next,peeing,the next,barfing,the next SUICIDE.</title>
<content type="html">So,<b>I Am</b> Anxious About Tomorrow.I felt like shitting for a moment,the next,peeing,the next,barfing,the next SUICIDE.</content>
<updated>2010-10-18T14:25:42Z</updated>
<link type="image/png" href="http://a2.twimg.com/profile_images/1143765870/akif2_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>AkifKeith (Akif)</name>
<uri>http://twitter.com/AkifKeith</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739160335</id>
<published>2010-10-18T14:25:42Z</published>
<link type="text/html" href="http://twitter.com/kmbyrd/statuses/27739160335" rel="alternate"/>
<title>I am an optimist but today has me a little sour.</title>
<content type="html"><b>I am</b> an optimist but today has me a little sour.</content>
<updated>2010-10-18T14:25:42Z</updated>
<link type="image/png" href="http://a2.twimg.com/profile_images/1125627186/IMG00475-20100911-2056_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://mobile.twitter.com" rel="nofollow">Twitter for Android</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>kmbyrd (Kristina Byrd)</name>
<uri>http://twitter.com/kmbyrd</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739160269</id>
<published>2010-10-18T14:25:42Z</published>
<link type="text/html" href="http://twitter.com/TruckieKeith/statuses/27739160269" rel="alternate"/>
<title>@NeverRawrAtJace i am so sleepy D:</title>
<content type="html"><a href="http://twitter.com/NeverRawrAtJace">@NeverRawrAtJace</a> <b>i am</b> so sleepy D:</content>
<updated>2010-10-18T14:25:42Z</updated>
<link type="image/png" href="http://a2.twimg.com/profile_images/1135654874/tumblr_l7jakkWty71qcggplo1_500_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>TruckieKeith (Keith Zetterstrom)</name>
<uri>http://twitter.com/TruckieKeith</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739159402</id>
<published>2010-10-18T14:25:41Z</published>
<link type="text/html" href="http://twitter.com/dottycomical/statuses/27739159402" rel="alternate"/>
<title>@oleuanna aww shucks...I am one of your official groupies....am chuffed! xx</title>
<content type="html"><a href="http://twitter.com/oleuanna">@oleuanna</a> aww shucks...<b>I am</b> one of your official groupies....am chuffed! xx</content>
<updated>2010-10-18T14:25:41Z</updated>
<link type="image/png" href="http://a2.twimg.com/profile_images/1144486650/Dotty_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>dottycomical (Dotty Comical)</name>
<uri>http://twitter.com/dottycomical</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739158327</id>
<published>2010-10-18T14:25:40Z</published>
<link type="text/html" href="http://twitter.com/GlamGurl_85/statuses/27739158327" rel="alternate"/>
<title>RT @KiissyFace @GlamGurl_85 I am! That's how I seen ur update lol* ohhh</title>
<content type="html">RT <a href="http://twitter.com/KiissyFace">@KiissyFace</a> <a href="http://twitter.com/GlamGurl_85">@GlamGurl_85</a> <b>I am</b>! That&apos;s how I seen ur update lol* ohhh</content>
<updated>2010-10-18T14:25:40Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/1133410748/profile_image_1285717953138_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twidroid.com" rel="nofollow">twidroid</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>GlamGurl_85 (Meela)</name>
<uri>http://twitter.com/GlamGurl_85</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739157812</id>
<published>2010-10-18T14:25:40Z</published>
<link type="text/html" href="http://twitter.com/elvinelvinelvin/statuses/27739157812" rel="alternate"/>
<title>@jmtuazon LOL trolling Ms Concepcion. I am entertained.</title>
<content type="html"><a href="http://twitter.com/jmtuazon">@jmtuazon</a> LOL trolling Ms Concepcion. <b>I am</b> entertained.</content>
<updated>2010-10-18T14:25:40Z</updated>
<link type="image/png" href="http://a1.twimg.com/profile_images/1140448593/elvin_run_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://mobile.twitter.com" rel="nofollow">Mobile Web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>elvinelvinelvin (Elvin Luciano)</name>
<uri>http://twitter.com/elvinelvinelvin</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739157760</id>
<published>2010-10-18T14:25:40Z</published>
<link type="text/html" href="http://twitter.com/irmasuryani/statuses/27739157760" rel="alternate"/>
<title>never getting sick of listening gossip man-GD, LOVE this song. "everybody attention please I am gossip man" LOL</title>
<content type="html">never getting sick of listening gossip man-GD, LOVE this song. &quot;everybody attention please <b>I am</b> gossip man&quot; LOL</content>
<updated>2010-10-18T14:25:40Z</updated>
<link type="image/png" href="http://a3.twimg.com/profile_images/1088729019/gdragon127728184283799m_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>irmasuryani (Irma Suryani)</name>
<uri>http://twitter.com/irmasuryani</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739157216</id>
<published>2010-10-18T14:25:40Z</published>
<link type="text/html" href="http://twitter.com/prettybrown0114/statuses/27739157216" rel="alternate"/>
<title>It bothers me when people are nervous around me... as shy and laid back as I am, it just puts up a big wall.</title>
<content type="html">It bothers me when people are nervous around me... as shy and laid back as <b>I am</b>, it just puts up a big wall.</content>
<updated>2010-10-18T14:25:40Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/1116648932/shay_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://tinyurl.com/tweetcaster" rel="nofollow">TweetCaster</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>prettybrown0114 (Rashay Knight)</name>
<uri>http://twitter.com/prettybrown0114</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739156069</id>
<published>2010-10-18T14:25:39Z</published>
<link type="text/html" href="http://twitter.com/_lindseybryant_/statuses/27739156069" rel="alternate"/>
<title>Wow...I am so pissed off today.</title>
<content type="html">Wow...<b>I am</b> so pissed off today.</content>
<updated>2010-10-18T14:25:39Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/1141754860/a_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="/devices" rel="nofollow">txt</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>_lindseybryant_ (Lindsey Bryant)</name>
<uri>http://twitter.com/_lindseybryant_</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739155439</id>
<published>2010-10-18T14:25:38Z</published>
<link type="text/html" href="http://twitter.com/im_eel/statuses/27739155439" rel="alternate"/>
<title>libra librarian, kinna vegetarian but like a lil meat to go deep when she beep beep. skeet skeet, she is my sorority. I am her fraternity</title>
<content type="html">libra librarian, kinna vegetarian but like a lil meat to go deep when she beep beep. skeet skeet, she is my sorority. <b>I am</b> her fraternity</content>
<updated>2010-10-18T14:25:38Z</updated>
<link type="image/png" href="http://a0.twimg.com/profile_images/1110866520/kBxmF_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>im_eel (tizzy)</name>
<uri>http://twitter.com/im_eel</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739155176</id>
<published>2010-10-18T14:25:38Z</published>
<link type="text/html" href="http://twitter.com/Magicholas/statuses/27739155176" rel="alternate"/>
<title>@SelenaMarieFaux I am good,you?</title>
<content type="html"><a href="http://twitter.com/SelenaMarieFaux">@SelenaMarieFaux</a> <b>I am</b> good,you?</content>
<updated>2010-10-18T14:25:38Z</updated>
<link type="image/png" href="http://a3.twimg.com/profile_images/1146878743/nickyj_copy_normal.png" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>Magicholas (Boss.)</name>
<uri>http://twitter.com/Magicholas</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739154907</id>
<published>2010-10-18T14:25:38Z</published>
<link type="text/html" href="http://twitter.com/lavon_temple/statuses/27739154907" rel="alternate"/>
<title>I am too! RT @ButlerAlumni: Let's hope all alums are! RT @AdrienneBailey: Very excited for @butleru Homecoming this weekend!!</title>
<content type="html"><b>I am</b> too! RT <a href="http://twitter.com/ButlerAlumni">@ButlerAlumni</a>: Let&apos;s hope all alums are! RT <a href="http://twitter.com/AdrienneBailey">@AdrienneBailey</a>: Very excited for <a href="http://twitter.com/butleru">@butleru</a> Homecoming this weekend!!</content>
<updated>2010-10-18T14:25:38Z</updated>
<link type="image/png" href="http://a1.twimg.com/profile_images/1130294333/31395_570904984882_21106008_33644016_1851411_n_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="http://twitter.com/">web</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>lavon_temple (Lavon Temple)</name>
<uri>http://twitter.com/lavon_temple</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:27739153462</id>
<published>2010-10-18T14:25:37Z</published>
<link type="text/html" href="http://twitter.com/TiffanySeawell/statuses/27739153462" rel="alternate"/>
<title>I am so glad I don't have school today :)</title>
<content type="html"><b>I am</b> so glad I don&apos;t have school today :)</content>
<updated>2010-10-18T14:25:37Z</updated>
<link type="image/png" href="http://a2.twimg.com/profile_images/1146956230/40881_445683489170_663049170_5047995_1105465_n_normal.jpg" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:metadata>
<twitter:result_type>recent</twitter:result_type>
</twitter:metadata>
<twitter:source><a href="/devices" rel="nofollow">txt</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>TiffanySeawell (TIffany Lane Seawell)</name>
<uri>http://twitter.com/TiffanySeawell</uri>
</author>
</entry>
</feed>
Output example
Code
wget http://search.twitter.com/search.atom?q=%22i+am%22
mv 'search.atom?q="i+am"' search.txt
sed -f cleaner.sed search.txt > search1.txt
cat search_total.txt search1.txt > search2.txt
mv search2.txt search_total.txt
text2wave search_total.txt > text.wav
aplay -q text.wav & aplay -q hiscores.wav
#cleaning my search output
/content/!d
s/<content type="html">/ /g
s/<\/content>/ /g
s/</ /g
s/b>/ /g
/a href=/,/\/a>/d
s/&apos;/'/g
s/\// /g
s/ / /g
s/&quot;/ /g