locked
Twitter - Simple way to show tweets using the API? RRS feed

  • Question

  • User-29703693 posted

    I want to display the last 4 tweets on my website.  I've done the following below which works fine but I'd like all of the urls and twitter names in the title to be hyperlinked.  Is parsing the title the best option or is there another approach I should take?


    Sub GetTweets()
            Dim xmlDoc = New System.Xml.XmlDocument
            xmlDoc.Load("http://search.twitter.com/search.atom?q=asp.net&rpp=4")
    
            'create the select the nodes
            Dim root As System.Xml.XmlElement = xmlDoc.DocumentElement
            Dim nodeList As System.Xml.XmlNodeList = xmlDoc.GetElementsByTagName("entry")
    
            lblTweets.Text = ""
            Dim uri = ""
            Dim name = ""
            Dim title = ""
            For i As Integer = 0 To nodeList.Count - 1
                name = nodeList.Item(i).ChildNodes(9).ChildNodes(0).InnerText
                name = name.Substring(0, name.IndexOf("("))
                uri = nodeList.Item(i).ChildNodes(9).ChildNodes(1).InnerText
                title = nodeList.Item(i).ChildNodes(3).InnerText
    
                lblTweets.Text += String.Format("@<a style='color:#01a54e;' href='{0}' target='_blank'>{1}</a> {2}<br />", _
                                                uri, name, title)
            Next
    
        End Sub


    Tuesday, October 13, 2009 7:05 PM

Answers

  • User-29703693 posted

    After I posted, I realized that there's a content tag in the rss file that does what I'm looking for.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 13, 2009 9:46 PM

All replies