Coding For a Living

rss

A place to share and comment about coding for a living.


VB RSS Feed Aggregator Mike McIntyre

A RSS feed aggregator aggregates syndicated web content such as online newspapers, blogs, podcasts, and video blogs (vlogs) for various purposes e.g. to provide one location for easy viewing.

The VB module provides a code sample for one way you can create a RSS feed aggregator with VisualBasic.

Module Module1
    Const feedUrl As String = "http://+:8086/VBfeeds/"


    Sub Main()
        Dim listener As New HttpListener

        listener.Prefixes.Add(feedUrl)
        listener.Start()

        'Open a browser pointing at the feeds being served.
        System.Diagnostics.Process.Start("iexplore.exe", "http://localhost:8086/VBfeeds/")

        'Serve requests.
        While True
            Dim context As HttpListenerContext = listener.GetContext()
            Dim body As XElement = GetReplyBody()
            context.Response.ContentType = "text/xml"

            Using writer As XmlWriter = New XmlTextWriter(context.Response.OutputStream, System.Text.Encoding.UTF8)
                body.WriteTo(writer)
            End Using
        End While

    End Sub

    Function GetReplyBody() As XElement
        Dim feeds() As String = {"http://blogs.msdn.com/vbteam/rss.aspx?Tags=VB6_5F00_Migration_2F00_
                                 "http://blogs.msdn.com/vsdata/rss.xml", _
                                 "http://blogs.msdn.com/vbteam/rss.aspx?Tags=IDE&AndTags=1"}

        Return 
                   
                       VB Genius
                       http://+:8086/VBfeeds/
                       VB Team Members
                       XLinq-based RSS aggregator using VB Only Super Cool XML Literals Feature
                       
                   
               
    End Function
End Module