Don't display duplicate links when subscribing and use feed URL when title isn't supplied

This commit is contained in:
2017-03-02 09:23:44 -05:00
parent 2f7a268013
commit f58e4737c0

View File

@@ -32,7 +32,8 @@ namespace FeedCenter
// Look for all RSS or atom links in the document // Look for all RSS or atom links in the document
var rssLinks = htmlDocument.DocumentNode.Descendants("link") var rssLinks = htmlDocument.DocumentNode.Descendants("link")
.Where(n => n.Attributes["type"] != null && (n.Attributes["type"].Value == "application/rss+xml" || n.Attributes["type"].Value == "application/atom+xml")) .Where(n => n.Attributes["type"] != null && (n.Attributes["type"].Value == "application/rss+xml" || n.Attributes["type"].Value == "application/atom+xml"))
.Select(n => new Tuple<string, string>(UrlHelper.GetAbsoluteUrlString(feed.Source, n.Attributes["href"].Value), WebUtility.HtmlDecode(n.Attributes["title"]?.Value ?? string.Empty))) .Select(n => new Tuple<string, string>(UrlHelper.GetAbsoluteUrlString(feed.Source, n.Attributes["href"].Value), WebUtility.HtmlDecode(n.Attributes["title"]?.Value ?? feedUrl)))
.Distinct()
.ToList(); .ToList();
// If there was only one link found then switch to feed to it // If there was only one link found then switch to feed to it