Here is the improved code, now it won’t run in to the Twitter Request Per Day Limit.
static void Main(string[] args)
{
/*
* URL for Favoirtes: http://twitter.com/favorites/YourUserNameOnTwitter.xml?page=1
*/
WebRequest req;
req = WebRequest.Create( (string.Format(“http://twitter.com/favorites/YourUserNameOnTwitter.xml?page={0}”, 1)));
NetworkCredential creds = new NetworkCredential(“YourUserNameOnTwitter”, “YouUserNameTwitterPassword”);
req.Credentials = creds;
req.Method = “GET”;
string respString = “”;
for (int i = 101; i < 160; i++)
{
req = WebRequest.Create(string.Format(“http://twitter.com/favorites/YourUserNameOnTwitter.xml?page={0}”, i));
WebResponse resp = (WebResponse)req.GetResponse();
Stream respStream = resp.GetResponseStream();
StreamReader reader = new StreamReader(respStream);
respString = respString + reader.ReadToEnd();
reader.Close();
respStream.Close();
resp.Close();
Console.Write(respString);
}
// create a writer and open the file
TextWriter tw = new StreamWriter(“C:\YourUserNameOnTwitterFavorite.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();
}
Grab it while it is hot!
Anyone out there who wanna work with me to improve it? Sky is the limit people!