After a bit of fiddling about, I decided to use the ATOM format, and the SyndicationFeed API that came with WCF. I came up with this simple command line tool that lets you type a search query, and it’ll list the top 10 results. The code is quite short and simple to understand.
class Program
{
static void Main(string[] args)
{
Console.Write("twitter -> ");
var input = Console.ReadLine();
while (input != "exit")
{
var scrubbed = HttpUtility.UrlEncode(input);
var reader = XmlReader.Create(
string.Format("http://search.twitter.com/search.atom?lang=en&q={0}", scrubbed));
var feed = SyndicationFeed.Load(reader);
foreach (SyndicationItem item in feed.Items)
{
Console.WriteLine("\t{0} - {1}", item.Authors[0].Name, item.Title.Text);
}
Console.Write("\ntwitter -> ");
input = Console.ReadLine();
}
}
}
To use it, you just need to add references to System.ServiceModel.dll, and System.Web.dll.Enjoy!