lemonad: jonas nockert's weblog

mars 12, 2007

Twitter Feeds support http if-modified-since

When looking at the twitter feeds today I noticed that they support http if-modified-since. Type in the following in your shell:

$ curl -z "20070312 00:00:00 CET"
         http://twitter.com/statuses/user_timeline/663633.rss

and it returns:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
 <channel>
  <title>Twitter / lemonad</title>
  <link>http://twitter.com/lemonad</link>
  <description>Twitter updates from lemonad</description>
  <language>en-us</language>
  <ttl>40</ttl>
  <item>
   <title>lemonad: This is a message</title>
   <description>lemonad: This is a message</description>
   <pubDate>Mon, 12 Mar 2007 05:11:34 +0000</pubDate>
   <guid>http://twitter.com/lemonad/statuses/6883771</guid>
   <link>http://twitter.com/lemonad/statuses/6883771</link>
  </item>
  <item>
   <title>lemonad: This is another message</title>
   <description>lemonad: This is another message</description>
   <pubDate>Mon, 12 Mar 2007 00:15:46 +0000</pubDate>
   <guid>http://twitter.com/lemonad/statuses/6806561</guid>
   <link>http://twitter.com/lemonad/statuses/6806561</link>
  </item>
 </channel>
</rss>

but if you instead type:

$ curl -z "20070312 02:00:00 CET"
         http://twitter.com/statuses/user_timeline/663633.rss

you will get the following result:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
 <channel>
  <title>Twitter / lemonad</title>
  <link>http://twitter.com/lemonad</link>
  <description>Twitter updates from lemonad</description>
  <language>en-us</language>
  <ttl>40</ttl>
  <item>
   <title>lemonad: This is a message</title>
   <description>lemonad: This is a message</description>
   <pubDate>Mon, 12 Mar 2007 05:11:34 +0000</pubDate>
   <guid>http://twitter.com/lemonad/statuses/6883771</guid>
   <link>http://twitter.com/lemonad/statuses/6883771</link>
  </item>
 </channel>
</rss>

Unfortunately, it doesn't seem like there's any way of getting back more than 20 items, no matter what date and time is used.

20070313: Add ?count=n to the end of the feed url where n is the number of entries you want. This way you can get a lot more than 20 entries.

20070318: From the Twitter Development Talk group:

Wow, Jonas, you found that recent addition before we even documented
it! You totally get a gold star :)
--
Alex Payne
Obvious
http://twitter.com/al3x

By the way, if you haven't already got SXSW- and twitter-induced ADD or you're willing to live with it, then by all means feel free to add me!

post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting :)