User:Laura Macchini/prototyping/iamsoglad

From XPUB & Lens-Based wiki

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/&quot;i am&quot;</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>&quot;i am&quot; - 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&amp;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&amp;page=2&amp;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">&lt;a href=&quot;http://twitter.com/MAKEitWET_JAN25&quot;&gt;@MAKEitWET_JAN25&lt;/a&gt; shit u not like me  i just act like no one is here waste yo energy muthafucka lol i know u there lol yup &lt;b&gt;i am&lt;/b&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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">&lt;a href=&quot;http://twitter.com/MUWithdrawal&quot;&gt;@MUWithdrawal&lt;/a&gt; Thanks honey. &lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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,&lt;b&gt;I Am&lt;/b&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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">&lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://mobile.twitter.com&quot; rel=&quot;nofollow&quot;&gt;Twitter for Android&lt;/a&gt;</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">&lt;a href=&quot;http://twitter.com/NeverRawrAtJace&quot;&gt;@NeverRawrAtJace&lt;/a&gt; &lt;b&gt;i am&lt;/b&gt; 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>&lt;a href=&quot;http://www.tweetdeck.com&quot; rel=&quot;nofollow&quot;&gt;TweetDeck&lt;/a&gt;</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">&lt;a href=&quot;http://twitter.com/oleuanna&quot;&gt;@oleuanna&lt;/a&gt; aww shucks...&lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://www.tweetdeck.com&quot; rel=&quot;nofollow&quot;&gt;TweetDeck&lt;/a&gt;</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 &lt;a href=&quot;http://twitter.com/KiissyFace&quot;&gt;@KiissyFace&lt;/a&gt; &lt;a href=&quot;http://twitter.com/GlamGurl_85&quot;&gt;@GlamGurl_85&lt;/a&gt; &lt;b&gt;I am&lt;/b&gt;! That&amp;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>&lt;a href=&quot;http://twidroid.com&quot; rel=&quot;nofollow&quot;&gt;twidroid&lt;/a&gt;</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">&lt;a href=&quot;http://twitter.com/jmtuazon&quot;&gt;@jmtuazon&lt;/a&gt; LOL trolling Ms Concepcion. &lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://mobile.twitter.com&quot; rel=&quot;nofollow&quot;&gt;Mobile Web&lt;/a&gt;</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. &quot;everybody attention please I am gossip man&quot; LOL</title>
    <content type="html">never getting sick of listening gossip man-GD, LOVE this song. &amp;quot;everybody attention please &lt;b&gt;I am&lt;/b&gt; gossip man&amp;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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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 &lt;b&gt;I am&lt;/b&gt;, 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>&lt;a href=&quot;http://tinyurl.com/tweetcaster&quot; rel=&quot;nofollow&quot;&gt;TweetCaster&lt;/a&gt;</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...&lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;/devices&quot; rel=&quot;nofollow&quot;&gt;txt&lt;/a&gt;</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. &lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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">&lt;a href=&quot;http://twitter.com/SelenaMarieFaux&quot;&gt;@SelenaMarieFaux&lt;/a&gt; &lt;b&gt;I am&lt;/b&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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">&lt;b&gt;I am&lt;/b&gt; too! RT &lt;a href=&quot;http://twitter.com/ButlerAlumni&quot;&gt;@ButlerAlumni&lt;/a&gt;: Let&amp;apos;s hope all alums are! RT &lt;a href=&quot;http://twitter.com/AdrienneBailey&quot;&gt;@AdrienneBailey&lt;/a&gt;: Very excited for &lt;a href=&quot;http://twitter.com/butleru&quot;&gt;@butleru&lt;/a&gt; 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>&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;</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">&lt;b&gt;I am&lt;/b&gt; so glad I don&amp;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>&lt;a href=&quot;/devices&quot; rel=&quot;nofollow&quot;&gt;txt&lt;/a&gt;</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

File:I am so glad .ogg


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/&lt;/ /g
s/b&gt;/ /g
/a href=/,/\/a&gt;/d
s/&amp;apos;/'/g
s/\// /g
s/  / /g
s/&amp;quot;/ /g