1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-29 02:57:15 +02:00
Sonarr/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs

29 lines
988 B
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;
2013-04-07 10:30:37 +03:00
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
{
2013-09-14 02:17:58 +03:00
public class OmgwtfnzbsParser : RssParserBase
2013-04-07 10:30:37 +03:00
{
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-09-14 02:17:58 +03:00
protected override long GetSize(XElement item)
2013-04-07 10:30:37 +03:00
{
2013-09-14 02:17:58 +03:00
var sizeString = Regex.Match(item.Description(), @"(?:Size:\<\/b\>\s\d+\.)\d{1,2}\s\w{2}(?:\<br \/\>)", RegexOptions.IgnoreCase | RegexOptions.Compiled).Value;
return ParseSize(sizeString);
2013-04-07 10:30:37 +03:00
}
}
}