<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.wiki.mohid.com/index.php?action=history&amp;feed=atom&amp;title=Twitter</id>
		<title>Twitter - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.wiki.mohid.com/index.php?action=history&amp;feed=atom&amp;title=Twitter"/>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Twitter&amp;action=history"/>
		<updated>2026-04-05T01:05:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>http://www.wiki.mohid.com/index.php?title=Twitter&amp;diff=920&amp;oldid=prev</id>
		<title>Guillaume: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Twitter&amp;diff=920&amp;oldid=prev"/>
				<updated>2008-12-03T10:39:08Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:39, 3 December 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Guillaume</name></author>	</entry>

	<entry>
		<id>http://www.wiki.mohid.com/index.php?title=Twitter&amp;diff=919&amp;oldid=prev</id>
		<title>192.168.20.177: /* Using twitter with curl */</title>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Twitter&amp;diff=919&amp;oldid=prev"/>
				<updated>2008-05-26T14:19:19Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Using twitter with &lt;a href=&quot;/index.php?title=Curl&quot; title=&quot;Curl&quot;&gt;curl&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[http://www.twitter.com Twitter] is a social short messaging system from the web to the outside world.&lt;br /&gt;
It can be used to send messages to friends. A practical utility is to have a bot-twitter-user that broadcasts messages from scheduled scripts. It could confirm the status of an ongoing process or job with an sms.&lt;br /&gt;
&lt;br /&gt;
==Using twitter with [[curl]]==&lt;br /&gt;
&lt;br /&gt;
 curl -u mohid1:***** -d status=&amp;quot;Having fun with curl&amp;quot; http://twitter.com/statuses/update.xml&lt;br /&gt;
&lt;br /&gt;
==Mohid Twitter project==&lt;br /&gt;
Make sure you have accessible from your system path the following GNU utilities:&lt;br /&gt;
# tee&lt;br /&gt;
# grep&lt;br /&gt;
# tail&lt;br /&gt;
# curl&lt;br /&gt;
Save this code as a batchfile:&lt;br /&gt;
&lt;br /&gt;
 REM MohidTwitter.bat&lt;br /&gt;
 REM Usage syntax:&lt;br /&gt;
 REM &amp;gt; MohidWater.exe | tee Run1.log&lt;br /&gt;
 REM &amp;gt; Call MohidTwitter.bat Run1.log&lt;br /&gt;
 @echo off&lt;br /&gt;
 &lt;br /&gt;
 REM Please edit the username and password value&lt;br /&gt;
 set username=MyUsername&lt;br /&gt;
 set password=MyPass&lt;br /&gt;
 &lt;br /&gt;
 type %1 | grep MOHID | grep &amp;quot;[^-]$&amp;quot; | tail -n 1 &amp;gt; _tmp.txt&lt;br /&gt;
 set /P mess=&amp;lt;_tmp.txt&lt;br /&gt;
 echo %mess%&lt;br /&gt;
 curl -u %username%:%password% -d status=&amp;quot;%mess%&amp;quot; &amp;quot;http://twitter.com/statuses/update.xml&amp;quot;&lt;br /&gt;
 del _tmp.txt&lt;br /&gt;
 &lt;br /&gt;
 @echo on&lt;br /&gt;
&lt;br /&gt;
==Bot agents==&lt;br /&gt;
*[http://www.twitter.com/mohid1 mohid1]: Pre-op model;&lt;br /&gt;
*[http://www.twitter.com/weatherlisbon weatherlisbon]: BBC lisbon weather forecast;&lt;br /&gt;
*[http://www.twitter.com/marvin_bot marvin_bot]: Marvin, the paranoid android;&lt;br /&gt;
*[http://www.twitter.com/euromillions euromillions]: Every friday night you get the euromillions results;&lt;br /&gt;
*[http://www.twitter.com/weatherhannover weatherhannover]: BBC hannover weather forecast;&lt;br /&gt;
*[http://www.twitter.com/biosfera Biosfera]: Meteo-IST;&lt;br /&gt;
&lt;br /&gt;
==Maretec agents==&lt;br /&gt;
*[http://www.twitter.com/guillaume7 Guillaume R.]&lt;br /&gt;
*[http://www.twitter.com/bartb_pt Bartolomeu B.]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;rss&amp;gt;http://twitter.com/statuses/user_timeline/6626342.rss&amp;lt;/rss&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Twitter bot script==&lt;br /&gt;
===bash example===&lt;br /&gt;
Here's a sample bash script that uses curl to extract a weather forecast from an rss feed and twit it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[bash,Y]&lt;br /&gt;
 #! /bin/sh&lt;br /&gt;
 &lt;br /&gt;
 #This line is important if you are to put this script as a cronjob&lt;br /&gt;
 #Goto the folder where the bash script exists.&lt;br /&gt;
 here=/home/[user]/scripts&lt;br /&gt;
 cd $here&lt;br /&gt;
 &lt;br /&gt;
 #BBC Lisbon weather id&lt;br /&gt;
 id=0048&lt;br /&gt;
 &lt;br /&gt;
 #BBC weather RSS feed address&lt;br /&gt;
 feed=&amp;quot;http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/${id}.xml&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 #City&lt;br /&gt;
 city=lisbon&lt;br /&gt;
 &lt;br /&gt;
 #temporary file&lt;br /&gt;
 file=&amp;quot;weather${city}.txt&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 #Weather twitter bot&lt;br /&gt;
 twitbot=weatherlisbon:w*****r&lt;br /&gt;
 &lt;br /&gt;
 #Read the RSS feed and filter it&lt;br /&gt;
 curl $feed 2&amp;gt;&amp;amp;1 | grep 'title' | tail -n 1 | perl -wlne'm/title&amp;gt;(.*)&amp;lt;\/title/i &amp;amp;&amp;amp; print $1' | &lt;br /&gt;
 sed -e  &amp;quot;s/\&amp;amp;\#xB0;//g&amp;quot; &amp;gt; $file&lt;br /&gt;
 # use this line instead, to filter out the Fahrenheit degrees, as well as the leading &amp;quot;the forecast for&amp;quot;&lt;br /&gt;
 #sed -e &amp;quot;s/\&amp;amp;\#xB0;//g&amp;quot; | sed -e &amp;quot;s/ [\(][0-9]*F[\)]//g&amp;quot; | sed -e &amp;quot;s/[[:space:]]\+/ /g&amp;quot; | cut -d ' ' -f4-21 &amp;gt; $file&lt;br /&gt;
 &lt;br /&gt;
 #Read the forecast into a weather variable&lt;br /&gt;
 read weather &amp;lt; $file&lt;br /&gt;
 &lt;br /&gt;
 #Twit the weather variable away&lt;br /&gt;
 curl --basic --user $twitbot --data status=&amp;quot;$weather&amp;quot; http://twitter.com/statuses/update.xml&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch example===&lt;br /&gt;
Here's the [http://twitter.com/marvin_bot marvin_bot] agent script in batch. However, previously, you are required to have [http://cygwin.com/ cygwin] installed and the &amp;lt;code&amp;gt;%CYGWIN%\bin&amp;lt;/code&amp;gt; path added to your &amp;lt;code&amp;gt;%PATH%&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
 @ECHO off&lt;br /&gt;
 REM MARVIN BOT script&lt;br /&gt;
 &lt;br /&gt;
 REM Goto here&lt;br /&gt;
 set here=&amp;quot;D:\Users\Guillaume\guillaume\biscates\bots&amp;quot;&lt;br /&gt;
 cd %here%&lt;br /&gt;
 &lt;br /&gt;
 REM Marvin feed address&lt;br /&gt;
 set feed=&amp;quot;marvinquotes_srtd.txt&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 REM temporary file&lt;br /&gt;
 set file=&amp;quot;marvin_bot&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 REM Marvin twitter bot&lt;br /&gt;
 set user=marvin_bot&lt;br /&gt;
 set pass=****&lt;br /&gt;
 &lt;br /&gt;
 REM Read the feed and randomize it&lt;br /&gt;
 cat %feed% | shuf | head -n 1 &amp;gt; %file%.txt&lt;br /&gt;
 &lt;br /&gt;
 REM Read the message into a weather variable&lt;br /&gt;
 set /P mess=&amp;lt;%file%.txt&lt;br /&gt;
 echo %mess% &amp;gt;&amp;gt; %file%.log&lt;br /&gt;
 &lt;br /&gt;
 REM Timestamp the log file&lt;br /&gt;
 echo --------------------------------------------&amp;gt;&amp;gt; %file%.log&lt;br /&gt;
 echo %DATE% %TIME% &amp;gt;&amp;gt; %file%.log&lt;br /&gt;
 &lt;br /&gt;
 REM Twit the weather variable away&lt;br /&gt;
 wget --http-user=%user% --http-pass=%pass% --post-data=&amp;quot;status=%mess%&amp;quot; -O %file%.log http:// twitter.com/statuses/update.xml&lt;br /&gt;
 @ECHO on&lt;br /&gt;
&lt;br /&gt;
===Check if message is new===&lt;br /&gt;
This code in bash or batch checks for new messages to be twittered.&lt;br /&gt;
&lt;br /&gt;
====bash====&lt;br /&gt;
 touch &amp;quot;mess.log&amp;quot;&lt;br /&gt;
 if [ `diff mess.tmp mess.log | grep -e &amp;quot;^&amp;lt;&amp;quot; | wc -l` -eq 1 ]&lt;br /&gt;
 then&lt;br /&gt;
 &lt;br /&gt;
  #Uncomment one the following couple of lines&lt;br /&gt;
  #cat mess.tmp &amp;gt;&amp;gt; mess.log #keeps historical record of all messages&lt;br /&gt;
  #cat mess.tmp &amp;gt; mess.log #keeps only last message&lt;br /&gt;
 &lt;br /&gt;
  #...&lt;br /&gt;
 &lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
====batch====&lt;br /&gt;
NOTE: you need to find windows Xp [http://unxutils.sourceforge.net/ binaries] of grep, diff, sed, (g)awk, tail, head, cat, tac, sort and install them in your PATH.&lt;br /&gt;
 touch &amp;quot;mess.old&amp;quot;&lt;br /&gt;
 diff mess.tmp mess.old | grep -e &amp;quot;^&amp;lt;&amp;quot; | wc -l &amp;gt; diff.tmp&lt;br /&gt;
 set /P diff=&amp;lt;diff.tmp&lt;br /&gt;
 if %diff% neq 1 goto end&lt;br /&gt;
 goto mess&lt;br /&gt;
 &lt;br /&gt;
 :mess&lt;br /&gt;
 REM &amp;gt;&amp;gt; keeps historical record&lt;br /&gt;
 REM &amp;gt; keeps last mess&lt;br /&gt;
 REM Uncomment one the following couple of lines&lt;br /&gt;
 REM type mess.tmp&amp;gt;&amp;gt;mess.old&lt;br /&gt;
 REM type mess.tmp&amp;gt;mess.old&lt;br /&gt;
 &lt;br /&gt;
 :end&lt;br /&gt;
&lt;br /&gt;
===Sample food===&lt;br /&gt;
 &amp;gt; cat Novembro_SAASUTL.htm | \&lt;br /&gt;
 perl -ne 'm/&amp;gt;([^&amp;lt;&amp;gt;]*?)&amp;lt;\// &amp;amp;&amp;amp; print$1.&amp;quot;\n&amp;quot;' | \&lt;br /&gt;
 sed -f sasutl.sed -e '/^$/d' | \&lt;br /&gt;
 awk '/29-11-2007/,/30-11-2007/'&lt;br /&gt;
&lt;br /&gt;
#Get http://www.sas.utl.pt/alim/Ementas/View/View.aspx to \\guillaume\temp&lt;br /&gt;
#Transfer via winscp to point.pt -p 2996&lt;br /&gt;
&lt;br /&gt;
Status update&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
*[http://www.twitter.com Twitter home]&lt;br /&gt;
*[http://groups.google.com/group/twitter-development-talk/web/api-documentation Twitter api]&lt;br /&gt;
*[http://unxutils.sourceforge.net/ GNU for windows].&lt;br /&gt;
&lt;br /&gt;
[[Category:Technology]]&lt;/div&gt;</summary>
		<author><name>192.168.20.177</name></author>	</entry>

	</feed>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-56589921-5', 'auto');
  ga('send', 'pageview');
</script>