omgwtfnzbs fixes

New: connect to omgwtfnzbs over https
Fixed: No results found response for omgwtfnzbs
This commit is contained in:
Mark McDowall
2014-09-27 18:39:26 -07:00
parent e3efd9a84c
commit 97370cc8b3
4 changed files with 23 additions and 10 deletions
+20 -2
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
@@ -46,7 +45,7 @@ namespace NzbDrone.Core.Indexers
using (var xmlTextReader = XmlReader.Create(new StringReader(indexerResponse.Content), new XmlReaderSettings { DtdProcessing = DtdProcessing.Ignore, IgnoreComments = true }))
{
var document = XDocument.Load(xmlTextReader);
var items = document.Root.Element("channel").Elements("item");
var items = GetItems(document);
foreach (var item in items)
{
@@ -231,5 +230,24 @@ namespace NzbDrone.Core.Indexers
return Convert.ToInt64(result);
}
private IEnumerable<XElement> GetItems(XDocument document)
{
var root = document.Root;
if (root == null)
{
return Enumerable.Empty<XElement>();
}
var channel = root.Element("channel");
if (channel == null)
{
return Enumerable.Empty<XElement>();
}
return channel.Elements("item");
}
}
}