pretome: add imdb search and code clean up (#7916)

This commit is contained in:
Diego Heras 2020-03-29 13:45:30 +02:00 committed by GitHub
parent 96d1d4eee7
commit e808df2e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 126 additions and 197 deletions

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -19,19 +18,11 @@ namespace Jackett.Common.Indexers
public class Pretome : BaseWebIndexer public class Pretome : BaseWebIndexer
{ {
private string LoginUrl => SiteLink + "takelogin.php"; private string LoginUrl => SiteLink + "takelogin.php";
private string LoginReferer => SiteLink + "index.php?cat=1";
private string SearchUrl => SiteLink + "browse.php"; private string SearchUrl => SiteLink + "browse.php";
private new ConfigurationDataPinNumber configData => (ConfigurationDataPinNumber)base.configData;
private readonly List<CategoryMapping> resultMapping = new List<CategoryMapping>();
private new ConfigurationDataPinNumber configData
{
get => (ConfigurationDataPinNumber)base.configData;
set => base.configData = value;
}
public Pretome(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps) public Pretome(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)
: base(name: "PreToMe", : base("PreToMe",
description: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows", description: "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows",
link: "https://pretome.info/", link: "https://pretome.info/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(), caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
@ -45,130 +36,84 @@ namespace Jackett.Common.Indexers
Language = "en-us"; Language = "en-us";
Type = "private"; Type = "private";
AddCategoryMapping("cat[]=22&tags=Windows", TorznabCatType.PC0day); TorznabCaps.SupportsImdbMovieSearch = true;
AddCategoryMapping("cat[]=22&tags=MAC", TorznabCatType.PCMac); TorznabCaps.SupportsImdbTVSearch = true;
AddCategoryMapping("cat[]=22&tags=Linux", TorznabCatType.PC);
AddCategoryMapping("cat[]=27", TorznabCatType.BooksEbook); // Unfortunately most of them are tags not categories and they return the parent category
// we have to re-add the tags with the parent category so the results are not removed with the filtering
AddCategoryMapping("cat[]=4&tags=PC", TorznabCatType.PCGames); // Applications
AddCategoryMapping("cat[]=4&tags=RIP", TorznabCatType.PCGames); AddCategoryMappingAndParent("cat[]=22", TorznabCatType.PC);
AddCategoryMapping("cat[]=4&tags=ISO", TorznabCatType.PCGames); AddCategoryMappingAndParent("cat[]=22&tags=Windows", TorznabCatType.PC0day, TorznabCatType.PC);
AddCategoryMapping("cat[]=4&tags=XBOX360", TorznabCatType.ConsoleXbox360); AddCategoryMappingAndParent("cat[]=22&tags=MAC", TorznabCatType.PCMac, TorznabCatType.PC);
AddCategoryMapping("cat[]=4&tags=PS3", TorznabCatType.ConsolePS3); AddCategoryMappingAndParent("cat[]=22&tags=Linux", TorznabCatType.PC, TorznabCatType.PC);
AddCategoryMapping("cat[]=4&tags=Wii", TorznabCatType.ConsoleWii);
AddCategoryMapping("cat[]=4&tags=PSP", TorznabCatType.ConsolePSP);
AddCategoryMapping("cat[]=4&tags=NSD", TorznabCatType.ConsoleNDS);
AddCategoryMapping("cat[]=4&tags=XBox", TorznabCatType.ConsoleXbox);
AddCategoryMapping("cat[]=4&tags=PS2", TorznabCatType.ConsoleOther);
AddCategoryMapping("cat[]=31&tags=Ebook", TorznabCatType.BooksEbook); // Ebooks
AddCategoryMapping("cat[]=31&tags=RARFiX", TorznabCatType.Other); AddCategoryMappingAndParent("cat[]=27", TorznabCatType.BooksEbook);
AddCategoryMapping("cat[]=19&tags=x264", TorznabCatType.Movies); // Games
AddCategoryMapping("cat[]=19&tags=720p", TorznabCatType.MoviesHD); AddCategoryMappingAndParent("cat[]=4", TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=XviD", TorznabCatType.MoviesSD); AddCategoryMappingAndParent("cat[]=4&tags=PC", TorznabCatType.PCGames, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=BluRay", TorznabCatType.MoviesHD); AddCategoryMappingAndParent("cat[]=4&tags=RIP", TorznabCatType.PCGames, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=DVDRiP", TorznabCatType.MoviesSD); AddCategoryMappingAndParent("cat[]=4&tags=ISO", TorznabCatType.PCGames, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=1080p", TorznabCatType.MoviesHD); AddCategoryMappingAndParent("cat[]=4&tags=XBOX360", TorznabCatType.ConsoleXbox360, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=DVD", TorznabCatType.MoviesSD); AddCategoryMappingAndParent("cat[]=4&tags=PS3", TorznabCatType.ConsolePS3, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=DVDR", TorznabCatType.MoviesSD); AddCategoryMappingAndParent("cat[]=4&tags=Wii", TorznabCatType.ConsoleWii, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=WMV", TorznabCatType.Movies); AddCategoryMappingAndParent("cat[]=4&tags=PSP", TorznabCatType.ConsolePSP, TorznabCatType.Console);
AddCategoryMapping("cat[]=19&tags=CAM", TorznabCatType.Movies); AddCategoryMappingAndParent("cat[]=4&tags=NSD", TorznabCatType.ConsoleNDS, TorznabCatType.Console);
AddCategoryMappingAndParent("cat[]=4&tags=XBox", TorznabCatType.ConsoleXbox, TorznabCatType.Console);
AddCategoryMappingAndParent("cat[]=4&tags=PS2", TorznabCatType.ConsoleOther, TorznabCatType.Console);
AddCategoryMapping("cat[]=6&tags=MP3", TorznabCatType.AudioMP3); // Miscellaneous
AddCategoryMapping("cat[]=6&tags=V2", TorznabCatType.AudioMP3); AddCategoryMappingAndParent("cat[]=31", TorznabCatType.Other);
AddCategoryMapping("cat[]=6&tags=FLAC", TorznabCatType.AudioLossless); AddCategoryMappingAndParent("cat[]=31&tags=Ebook", TorznabCatType.BooksEbook, TorznabCatType.Other);
AddCategoryMapping("cat[]=6&tags=320kbps", TorznabCatType.AudioMP3); AddCategoryMappingAndParent("cat[]=31&tags=RARFiX", TorznabCatType.Other, TorznabCatType.Other);
AddCategoryMapping("cat[]=7&tags=x264", TorznabCatType.TVHD); // Movies
AddCategoryMapping("cat[]=7&tags=720p", TorznabCatType.TVHD); AddCategoryMappingAndParent("cat[]=19", TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=HDTV", TorznabCatType.TVHD); AddCategoryMappingAndParent("cat[]=19&tags=x264", TorznabCatType.Movies, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=XviD", TorznabCatType.TVSD); AddCategoryMappingAndParent("cat[]=19&tags=720p", TorznabCatType.MoviesHD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&BluRay", TorznabCatType.TVHD); AddCategoryMappingAndParent("cat[]=19&tags=XviD", TorznabCatType.MoviesSD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=DVDRip", TorznabCatType.TVSD); AddCategoryMappingAndParent("cat[]=19&tags=BluRay", TorznabCatType.MoviesHD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=DVD", TorznabCatType.TVSD); AddCategoryMappingAndParent("cat[]=19&tags=DVDRiP", TorznabCatType.MoviesSD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=Documentary", TorznabCatType.TVDocumentary); AddCategoryMappingAndParent("cat[]=19&tags=1080p", TorznabCatType.MoviesHD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=PDTV", TorznabCatType.TVSD); AddCategoryMappingAndParent("cat[]=19&tags=DVD", TorznabCatType.MoviesSD, TorznabCatType.Movies);
AddCategoryMapping("cat[]=7&tags=HD-DVD", TorznabCatType.TVSD); AddCategoryMappingAndParent("cat[]=19&tags=DVDR", TorznabCatType.MoviesSD, TorznabCatType.Movies);
AddCategoryMappingAndParent("cat[]=19&tags=WMV", TorznabCatType.Movies, TorznabCatType.Movies);
AddCategoryMappingAndParent("cat[]=19&tags=CAM", TorznabCatType.Movies, TorznabCatType.Movies);
AddCategoryMapping("cat[]=51&tags=XviD", TorznabCatType.XXXXviD); // Music
AddCategoryMapping("cat[]=51&tags=DVDRiP", TorznabCatType.XXXDVD); AddCategoryMappingAndParent("cat[]=6", TorznabCatType.Audio);
AddCategoryMappingAndParent("cat[]=6&tags=MP3", TorznabCatType.AudioMP3, TorznabCatType.Audio);
AddCategoryMappingAndParent("cat[]=6&tags=V2", TorznabCatType.AudioMP3, TorznabCatType.Audio);
AddCategoryMappingAndParent("cat[]=6&tags=FLAC", TorznabCatType.AudioLossless, TorznabCatType.Audio);
AddCategoryMappingAndParent("cat[]=6&tags=320kbps", TorznabCatType.AudioMP3, TorznabCatType.Audio);
// Unfortunately they are tags not categories so return the results // TV
// as the parent category so do not get results removed with the filtering. AddCategoryMappingAndParent("cat[]=7", TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=x264", TorznabCatType.TVHD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=720p", TorznabCatType.TVHD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=HDTV", TorznabCatType.TVHD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=XviD", TorznabCatType.TVSD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&BluRay", TorznabCatType.TVHD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=DVDRip", TorznabCatType.TVSD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=DVD", TorznabCatType.TVSD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=Documentary", TorznabCatType.TVDocumentary, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=PDTV", TorznabCatType.TVSD, TorznabCatType.TV);
AddCategoryMappingAndParent("cat[]=7&tags=HD-DVD", TorznabCatType.TVSD, TorznabCatType.TV);
AddResultCategoryMapping("cat[]=22&tags=Windows", TorznabCatType.PC); // XXX
AddResultCategoryMapping("cat[]=22&tags=MAC", TorznabCatType.PC); AddCategoryMappingAndParent("cat[]=51", TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=22&tags=Linux", TorznabCatType.PC); AddCategoryMappingAndParent("cat[]=51&tags=XviD", TorznabCatType.XXXXviD, TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=22&tags=All", TorznabCatType.PC); AddCategoryMappingAndParent("cat[]=51&tags=DVDRiP", TorznabCatType.XXXDVD, TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=22", TorznabCatType.PC);
AddResultCategoryMapping("cat[]=27&tags=All", TorznabCatType.Books);
AddResultCategoryMapping("cat[]=27", TorznabCatType.Books);
AddResultCategoryMapping("cat[]=4&tags=PC", TorznabCatType.PC);
AddResultCategoryMapping("cat[]=4&tags=RIP", TorznabCatType.PC);
AddResultCategoryMapping("cat[]=4&tags=ISO", TorznabCatType.PC);
AddResultCategoryMapping("cat[]=4&tags=XBOX360", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=PS3", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=Wii", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=PSP", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=NSD", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=XBox", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=PS2", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4&tags=All", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=4", TorznabCatType.Console);
AddResultCategoryMapping("cat[]=31&tags=Ebook", TorznabCatType.Books);
AddResultCategoryMapping("cat[]=31&tags=RARFiX", TorznabCatType.Other);
AddResultCategoryMapping("cat[]=31&tags=All", TorznabCatType.Other);
AddResultCategoryMapping("cat[]=31", TorznabCatType.Other);
AddResultCategoryMapping("cat[]=19&tags=x264", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=720p", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=XviD", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=BluRay", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=DVDRiP", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=1080p", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=DVD", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=DVDR", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=WMV", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=CAM", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19&tags=All", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=19", TorznabCatType.Movies);
AddResultCategoryMapping("cat[]=6&tags=MP3", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=6&tags=V2", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=6&tags=FLAC", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=6&tags=320kbps", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=6&tags=All", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=6", TorznabCatType.Audio);
AddResultCategoryMapping("cat[]=7&tags=x264", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=720p", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=HDTV", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=XviD", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&BluRay", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=DVDRip", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=DVD", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=Documentary", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=PDTV", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=HD-DVD", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7&tags=All", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=7", TorznabCatType.TV);
AddResultCategoryMapping("cat[]=51&tags=XviD", TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=51&tags=DVDRiP", TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=51&tags=All", TorznabCatType.XXX);
AddResultCategoryMapping("cat[]=51", TorznabCatType.XXX);
} }
protected void AddResultCategoryMapping(string trackerCategory, TorznabCategory newznabCategory) private void AddCategoryMappingAndParent(string trackerCategory, TorznabCategory newznabCategory,
TorznabCategory parentCategory = null)
{ {
resultMapping.Add(new CategoryMapping(trackerCategory.ToString(), null, newznabCategory.ID)); AddCategoryMapping(trackerCategory, newznabCategory);
if (!TorznabCaps.Categories.Contains(newznabCategory)) if (parentCategory != null && parentCategory.ID != newznabCategory.ID)
TorznabCaps.Categories.Add(newznabCategory); AddCategoryMapping(trackerCategory, parentCategory);
} }
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson) public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
@ -188,18 +133,14 @@ namespace Jackett.Common.Indexers
// Send Post // Send Post
var result = await PostDataWithCookies(LoginUrl, pairs, loginPage.Cookies); var result = await PostDataWithCookies(LoginUrl, pairs, loginPage.Cookies);
if (result.RedirectingTo == null) if (result.RedirectingTo == null)
{
throw new ExceptionWithConfigData("Login failed. Did you use the PIN number that pretome emailed you?", configData); throw new ExceptionWithConfigData("Login failed. Did you use the PIN number that pretome emailed you?", configData);
}
var loginCookies = result.Cookies;
// Get result from redirect // Get result from redirect
var loginCookies = result.Cookies;
await FollowIfRedirect(result, LoginUrl, null, loginCookies); await FollowIfRedirect(result, LoginUrl, null, loginCookies);
await ConfigureIfOK(loginCookies, result.Content != null && result.Content.Contains("logout.php"), () => await ConfigureIfOK(loginCookies, result.Content?.Contains("logout.php") == true,
{ () => throw new ExceptionWithConfigData("Failed", configData));
CookieHeader = string.Empty;
throw new ExceptionWithConfigData("Failed", configData);
});
return IndexerConfigurationStatus.RequiresTesting; return IndexerConfigurationStatus.RequiresTesting;
} }
@ -207,74 +148,61 @@ namespace Jackett.Common.Indexers
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{ {
var releases = new List<ReleaseInfo>(); var releases = new List<ReleaseInfo>();
var queryUrl = SearchUrl;
var queryCollection = new NameValueCollection(); var qc = new List<KeyValuePair<string, string>>(); // NameValueCollection don't support cat[]=19&cat[]=6
if (query.IsImdbQuery)
{
qc.Add("search", query.ImdbID);
qc.Add("st", "1");
qc.Add("sd", "1");
}
else if (!string.IsNullOrWhiteSpace(query.GetQueryString()))
{
qc.Add("search", query.GetQueryString());
qc.Add("st", "1");
}
// parse categories and tags
var catGroups = new HashSet<string>(); // HashSet instead of List to avoid duplicates
var tagGroups = new HashSet<string>();
var cats = MapTorznabCapsToTrackers(query); var cats = MapTorznabCapsToTrackers(query);
var tags = string.Empty;
var catGroups = new List<string>();
foreach (var cat in cats) foreach (var cat in cats)
{ {
//"cat[]=7&tags=x264" // "cat[]=7&tags=x264"
var cSplit = cat.Split('&'); var cSplit = cat.Split('&');
if (cSplit.Length > 0)
{ var gSplit = cSplit[0].Split('=');
var gsplit = cSplit[0].Split('='); if (gSplit.Length > 1)
if (gsplit.Length > 1) catGroups.Add(gSplit[1]); // category = 7
{
catGroups.Add(gsplit[1]);
}
}
if (cSplit.Length > 1) if (cSplit.Length > 1)
{ {
var gsplit = cSplit[1].Split('='); var tSplit = cSplit[1].Split('=');
if (gsplit.Length > 1) if (tSplit.Length > 1)
{ tagGroups.Add(tSplit[1]); // tag = x264
if (tags != string.Empty)
tags += ",";
tags += gsplit[1];
}
} }
} }
if (catGroups.Distinct().Count() == 1) // add categories
foreach (var cat in catGroups)
qc.Add("cat[]", cat);
// do not include too many tags as it'll mess with their servers
if (tagGroups.Count < 7)
{ {
queryCollection.Add("cat[]", catGroups.First()); qc.Add("tags", string.Join(",", tagGroups));
// if tags are specified match any
// if no tags are specified match all, with any we get random results
qc.Add("tf", tagGroups.Any() ? "any" : "all");
} }
if (!string.IsNullOrWhiteSpace(query.GetQueryString())) var searchUrl = SearchUrl + "?" + qc.GetQueryString();
{ var response = await RequestStringWithCookiesAndRetry(searchUrl);
queryCollection.Add("st", "1");
queryCollection.Add("search", query.GetQueryString());
}
// Do not include too many tags as it'll mess with their servers. if (response.IsRedirect) // re-login
if (tags.Split(',').Length < 7)
{
queryCollection.Add("tags", tags);
if (!string.IsNullOrWhiteSpace(tags))
{
// if tags are specified match any
queryCollection.Add("tf", "any");
}
else
{
// if no tags are specified match all, with any we get random results
queryCollection.Add("tf", "all");
}
}
if (queryCollection.Count > 0)
{
queryUrl += "?" + queryCollection.GetQueryString();
}
var response = await RequestStringWithCookiesAndRetry(queryUrl);
if (response.IsRedirect)
{ {
await ApplyConfiguration(null); await ApplyConfiguration(null);
response = await RequestStringWithCookiesAndRetry(queryUrl); response = await RequestStringWithCookiesAndRetry(searchUrl);
} }
try try
@ -287,40 +215,41 @@ namespace Jackett.Common.Indexers
var qLink = row.Children[1].QuerySelector("a"); var qLink = row.Children[1].QuerySelector("a");
var title = qLink.GetAttribute("title"); var title = qLink.GetAttribute("title");
if (qLink.QuerySelectorAll("span").Length == 1 && title.StartsWith("NEW! |")) if (qLink.QuerySelectorAll("span").Length == 1 && title.StartsWith("NEW! |"))
{
title = title.Substring(6).Trim(); title = title.Substring(6).Trim();
}
if (!query.MatchQueryStringAND(title))
continue; // we have to skip bad titles due to tags + any word search
var comments = new Uri(SiteLink + qLink.GetAttribute("href")); var comments = new Uri(SiteLink + qLink.GetAttribute("href"));
var qDownload = row.Children[2].QuerySelector("a"); var link = new Uri(SiteLink + row.Children[2].QuerySelector("a").GetAttribute("href"));
var dateStr = Regex.Replace(row.Children[5].InnerHtml, @"\<br[\s]{0,1}[\/]{0,1}\>", " "); var dateStr = Regex.Replace(row.Children[5].InnerHtml, @"\<br[\s]{0,1}[\/]{0,1}\>", " ");
var sizeStr = row.Children[7].TextContent;
var seeders = ParseUtil.CoerceInt(row.Children[9].TextContent);
var files = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(4)").TextContent);
var cat = row.FirstElementChild.FirstElementChild.GetAttribute("href").Replace("browse.php?", string.Empty);
var link = new Uri(SiteLink + qDownload.GetAttribute("href"));
var publishDate = DateTimeUtil.FromTimeAgo(dateStr); var publishDate = DateTimeUtil.FromTimeAgo(dateStr);
var size = ReleaseInfo.GetBytes(sizeStr); var files = ParseUtil.CoerceInt(row.Children[3].TextContent);
var size = ReleaseInfo.GetBytes(row.Children[7].TextContent);
var grabs = ParseUtil.CoerceInt(row.Children[8].TextContent);
var seeders = ParseUtil.CoerceInt(row.Children[9].TextContent);
var leechers = ParseUtil.CoerceInt(row.Children[10].TextContent); var leechers = ParseUtil.CoerceInt(row.Children[10].TextContent);
var grabs = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(9)").TextContent); var cat = row.FirstElementChild.FirstElementChild.GetAttribute("href").Replace("browse.php?", string.Empty);
var release = new ReleaseInfo var release = new ReleaseInfo
{ {
MinimumRatio = 1,
MinimumSeedTime = 172800, // 48 hours
Title = title, Title = title,
Comments = comments, Comments = comments,
Guid = comments, Guid = comments,
Link = link, Link = link,
PublishDate = publishDate, PublishDate = publishDate,
Size = size, Size = size,
Seeders = seeders,
Peers = leechers + seeders,
Category = MapTrackerCatToNewznab(cat), Category = MapTrackerCatToNewznab(cat),
Files = files, Files = files,
Grabs = grabs, Grabs = grabs,
Seeders = seeders,
Peers = leechers + seeders,
MinimumRatio = 1,
MinimumSeedTime = 172800, // 48 hours
DownloadVolumeFactor = 0, // ratioless DownloadVolumeFactor = 0, // ratioless
UploadVolumeFactor = 1 UploadVolumeFactor = 1
}; };
releases.Add(release); releases.Add(release);
} }
} }