2013-04-07 10:30:37 +03:00
|
|
|
using System;
|
|
|
|
using System.ServiceModel.Syndication;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
|
|
{
|
|
|
|
public class OmgwtfnzbsParser : BasicRssParser
|
|
|
|
{
|
|
|
|
protected override string GetNzbUrl(SyndicationItem item)
|
|
|
|
{
|
|
|
|
return item.Links[0].Uri.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string GetNzbInfoUrl(SyndicationItem item)
|
|
|
|
{
|
|
|
|
//Todo: Me thinks I need to parse details to get this...
|
|
|
|
var match = Regex.Match(item.Summary.Text, @"(?:\<b\>View NZB\:\<\/b\>\s\<a\shref\=\"")(?<URL>.+)(?:\""\starget)",
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
|
|
|
|
|
|
if (match.Success)
|
|
|
|
{
|
|
|
|
return match.Groups["URL"].Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return String.Empty;
|
|
|
|
}
|
|
|
|
|
2013-04-07 22:01:24 +03:00
|
|
|
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
|
2013-04-07 10:30:37 +03:00
|
|
|
{
|
|
|
|
if (currentResult != null)
|
|
|
|
{
|
|
|
|
var sizeString = Regex.Match(item.Summary.Text, @"Size:\<\/b\>\s\d+\.\d{1,2}\s\w{2}\<br \/\>", RegexOptions.IgnoreCase | RegexOptions.Compiled).Value;
|
2013-04-08 01:40:13 +03:00
|
|
|
currentResult.Size = GetReportSize(sizeString);
|
2013-04-07 10:30:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return currentResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|