1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2013-04-07 10:30:37 +03:00
using System;
using System.Text.RegularExpressions;
2013-08-06 05:45:57 +03:00
using System.Xml.Linq;
using NzbDrone.Core.Parser.Model;
2013-04-07 10:30:37 +03:00
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
{
public class OmgwtfnzbsParser : BasicRssParser
{
2013-08-06 05:45:57 +03:00
protected override string GetNzbInfoUrl(XElement item)
2013-04-07 10:30:37 +03:00
{
//Todo: Me thinks I need to parse details to get this...
2013-08-06 05:45:57 +03:00
var match = Regex.Match(item.Description(), @"(?:\<b\>View NZB\:\<\/b\>\s\<a\shref\=\"")(?<URL>.+)(?:\""\starget)",
2013-04-07 10:30:37 +03:00
RegexOptions.IgnoreCase | RegexOptions.Compiled);
if (match.Success)
{
return match.Groups["URL"].Value;
}
return String.Empty;
}
2013-08-06 05:45:57 +03:00
protected override ReportInfo PostProcessor(XElement item, ReportInfo currentResult)
2013-04-07 10:30:37 +03:00
{
if (currentResult != null)
{
2013-08-06 05:45:57 +03:00
var sizeString = Regex.Match(item.Description(), @"(?: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;
}
}
}