Blog
RSS feed

How to implement search of RSS feeds

We have observed that it is a very frequent need to restrict a search to RSS feeds. This is possible on the Live.com homepage by using the feed: keyword in your query.

While using this operator in an API query does not work, you can achieve the same result by specifying web.filetype=feed as a parameter in the request.

The following examples illustrate how to do this using XML, JSON, and SOAP.

XML Sample Request

http://api.search.live.net/xml.aspx?query=nba&sources=web&appid=YOUR_APPID&web.filetype=feed 

JSON Sample Request

http://api.search.live.net/json.aspx?AppId=YOUR_APPID&Query=nba&Sources=web&web.filetype=feed&JsonType=raw 

SOAP Sample Request

using (LiveSearchService service = new LiveSearchService())
        {
            // Build request
            SearchRequest request = new SearchRequest();
            request.AppId = AppId;
            request.Query = "nba";
            request.Sources = new SourceType[] { SourceType.Web };
            request.Web = new WebRequest();
            request.Web.FileType = "feed";

            // Send the request
            SearchResponse response = service.Search(request);

            // Display feed results
            Console.WriteLine("Web results for " + response.Query.SearchTerms);
            foreach (WebResult result in response.Web.Results)
            {
                Console.WriteLine("Title: {0}", result.Title);
                Console.WriteLine("Description: {0}", result.Description);
                Console.WriteLine("Url: {0}", result.Url);
                Console.WriteLine();
            }
        }

-- Beatrice Oltean, Program Manager, Live Search API

Published Thursday, May 14, 2009 1:32 PM by ianwh