The RSS Blog

News and commentary from the RSS and OPML community.

Continuing to play with the twitter API. See Part Un.

Last couple days, I made a new C# program to find ppl I'm following on Twitter that didn't follow me back. I, of course, unfollowed them.

I had to cache my friends XML, since the 150 call per hour rate limit, made it impossible to run once. The code follows. Hope you like and re-use.

        static string userid = "137692493";
        static void FindNoFollows()
        {
            string s = string.Format("https://api.twitter.com/1/friends/ids.xml?screen_name={0}", "talkSportscom");
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            if (!System.IO.File.Exists("ids.xml"))
            {
                doc.Load(s);
            }
            else
            {
                doc.Load("ids.xml");
            }

            foreach (System.Xml.XmlElement e in doc.SelectNodes("//id"))
            {
                try
                {
                    if (e.HasAttribute("done"))
                    {
                        continue;
                    }
                    e.SetAttribute("done", "true");
                    doc.Save("ids.xml");

                    // need to sleep 30 seconds between calls to avoid 150 rate limit per hour
                    //System.Threading.Thread.Sleep(30 * 1000);

                    s = string.Format("https://api.twitter.com/1/friends/ids.xml?user_id={0}", e.InnerText);
                    System.Xml.XmlDocument d = new System.Xml.XmlDocument();
                    d.Load(s);

                    System.Console.WriteLine(d.OuterXml);

                    System.Xml.XmlElement dt = (System.Xml.XmlElement)d.SelectSingleNode(
                        string.Format("//id[text()='{0}']", userid));
                    if (dt != null)
                    {
                        continue;
                    }

                    s = string.Format("https://api.twitter.com/1/users/lookup.xml?user_id={0}", e.InnerText);
                    d = new System.Xml.XmlDocument();
                    d.Load(s);
                    dt = (System.Xml.XmlElement)d.SelectSingleNode("//screen_name");

                    System.Diagnostics.Process.Start(string.Format("http://twitter.com/#!/{0}", dt.InnerText));
                }
                catch
                {
                    break;
                }

            }
        }
Reader Comments Subscribe
MoveisOnline

Decoracao

Moveis

Cozinhas

Interiores

Candeeiros

Mesas

Cadeiras

Espelhos

Quadros

I like how this whole blog is has this theme around it really techy nice makes me remember old school days
The vibram five fingers on sale have creative appreance and the function to protect our foot.In the fashionable world,exceplly in the Europe,whether shoes having innovative designs and healthy function are two of the most important factors when the customers descide to buy or not.Just because the vibram five fingers own both features,it becomes world well known.
www.betsebookofhealth.info
www.bestebookofhealth.info
welcome to (www.MallsJerseys.com) We are specialized in high quanlity jerseys we are wholesale NFL MLB NBA NHL Women Youth Jerseys $17 a pcs , free shipping any questions or needs are welcome ,we will endeavor to do best service for you. thanks in advance.
Welcome to http://www.MallsJerseys.com
[url]http://www.mallsjerseys.com[/url]
Type "339":