tags:

views:

320

answers:

2

how i can get feed url (RSS Or ATOM) from blog url ex:- http://anirudhagupta.blogspot.com/ So how i can get his feed dynamically by c#

i say that how i can get blog's feedurl by using Regex and c#

A: 

The Rss feeds can vary with what you specifically want to look at, but for blogspot it's usually

blogname/feeds/posts/default ie. http://anirudhagupta.blogspot.com/feeds/posts/default

If you're using VS 2008, you can use the SyndicationFeed object to read both RSS and ATOM feeds. (I assume this is what you want to do when you say "get his feed dynamically")

XmlReader reader = XmlReader.Create(feedUriString);
SyndicationFeed feed = SyndicationFeed.Load(reader);
foreach (SyndicationItem item in feed.Items)
{
//your code for rendering each item
}

http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.aspx http://jimleonardo.blogspot.com/2009/02/jimleocom-is-back-up-some-how-to.html

Jim Leonardo
you are right but i say that how i can get feedurl means to say that dynamically EX:- i have a 1 lac blogs then how i can get all blogs 'feedurl
+3  A: 

When you visit the root page of the site, ie. http://myblog.com/ you should find a link attribute in the head, something like:

<link rel="alternate" type="application/rss+xml" title="MyBlog RSS Feed" href="http://feeds.feedburner.com/MyBlog" />

Now, no site is guaranteed to have that link in the head, but if they want that little rss logo to show up in firefox or internet explorer when users visit their site, they probably have added that line. Wordpress does it by default.

Note: My examples are just fictitious examples, not real sites. But just look at the source of a few blogs you know, and you should see a link tag like this.

Sean
Re: Note: Remember RFC 2606 § 2, example.com and others are set aside for examples. http://tools.ietf.org/html/rfc2606#section-2
brianary
Thanks brian, I'll remember that for next time. Maybe if I had conformed to rfc 2606, I would have received the check ;)
Sean