Finally able to get the Favoirte (in a XML format) from Twitter with that nifty script, I encouraged anyone out there to improve it and share it here, and we can build a nifty tool that will feature as follow:
- Export the cool links from your Twitter Favoirtes to Digg or Delicious Account or Bookmarks2.com
- Export the harvested Links to Firefox or any browser
- Export the Fav. Tweets in a nice “Reousrce” file or whatever the storage you are using.
- Share among friends.
Sample Code is here, please provide your feedback, I encountered the Request Limt from Twitter, but if you know the better way and to beat the limit, it would be awesome:
static void Main(string[] args)
{
/*
* URL for Favoirtes: http://twitter.com/favorites/YourUserNameOnTwitter.xml?page=1
*/
string respString = “”;
for (int i = 95; i < 96; i++)
{
WebRequest req = WebRequest.Create(string.Format(“http://twitter.com/favorites/YourUserNameOnTwitter.xml?page={0}”, i));
NetworkCredential creds = new NetworkCredential(“YourUser”, “YourPassword”);
req.Credentials = creds;
req.Method = “GET”;
WebResponse resp = (WebResponse)req.GetResponse();
Stream respStream = resp.GetResponseStream();
StreamReader reader = new StreamReader(respStream);
respString = reader.ReadToEnd();
reader.Close();
respStream.Close();
resp.Close();
Console.Write(respString);
}
// create a writer and open the file
TextWriter tw = new StreamWriter(“C:\FavoriteFile.txt”);
// write a harvested favorite tweets to the file
tw.WriteLine(respString);
//TODO: Parse the XML, and then make it available to be searched by Twitter UserID, Keyword, and harvest the URL out of it!
Console.ReadLine();
}