Posts tagged "C#"
  1. 1 year ago 

    Follow-up: Twitter Favorite Harvester in C#, refactored

    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!

     


  2. 1 year ago 

    Twitter Favorite Harvester in C#.

    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:

    1. Export the cool links from your Twitter Favoirtes to Digg or Delicious Account or Bookmarks2.com
    2. Export the harvested Links to Firefox or any browser
    3. Export the Fav. Tweets in a nice “Reousrce” file or whatever the storage you are using.
    4. 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();



    }

     


avatar_128
 
 
I am Mohammed Mudassir Azeemi   resident of San Francisco Bay Area

and User Experience Designer & Software Architect

User Interface Does Matter!

 
 

Following

designadaygermannywireframesuiscrapsrhjrheather-rivers
 

Tumblr