Reputation: 37633
Why do MS Syndication class doesn't accept valid RSS feed?
public static Stream GetResponseStream(string url)
{
var uri = new Uri(url, true);
WebRequest request = WebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Get;
WebResponse response = request.GetResponse();
return response.GetResponseStream();
}
public static void GetRSS()
{
using (Stream stream1 = GetResponseStream("http://www.lostfilm.tv/rssdd.xml"))
{
try
{
XmlReader xmlReader = XmlReader.Create(stream1);
var feeds = SyndicationFeed.Load(xmlReader);
}
catch (Exception ex)
{
// Error :(
}
}
}
RSS is valid itself:
http://validator.w3.org/appc/check.cgi?url=http%3A%2F%2Fwww.lostfilm.tv%2Frssdd.xml
Upvotes: 1
Views: 664
Reputation: 55946
SyndicationFeed
only supports RSS 2.0 and Atom 1.0 (your RSS version is 0.91).
You can use an external library, such as Argotic Syndication Framework.
Install the package with NuGet:
Install-Package Argotic.Core
and then try with:
var feed = RssFeed.Create(new Uri("http://www.lostfilm.tv/rssdd.xml", true));
foreach (var post in feed.Channel.Items)
{
Console.WriteLine(post.Title);
}
Upvotes: 1