mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
@@ -90,7 +90,6 @@ namespace Jackett.Common.Indexers
|
||||
|
||||
AddCategoryMapping(1, TorznabCatType.Movies);
|
||||
AddCategoryMapping(2, TorznabCatType.TV);
|
||||
AddCategoryMapping(3, TorznabCatType.Other);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,7 +156,7 @@ namespace Jackett.Common.Indexers
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
string errorMessage = ParseErrorMessage(preRequest);
|
||||
var errorMessage = ParseErrorMessage(preRequest);
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
}
|
||||
|
||||
@@ -168,8 +167,8 @@ namespace Jackett.Common.Indexers
|
||||
|
||||
await ConfigureIfOK(response.Cookies, response.Cookies.Contains("sid="), () =>
|
||||
{
|
||||
// Couldn't find "sid" cookie, so check for error
|
||||
var parser = new HtmlParser();
|
||||
// Couldn't find "sid" cookie, so check for error
|
||||
var parser = new HtmlParser();
|
||||
var dom = parser.ParseDocument(response.ContentString);
|
||||
var errorMessage = dom.QuerySelector(".flash.error").TextContent.Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
@@ -223,11 +222,18 @@ namespace Jackett.Common.Indexers
|
||||
};
|
||||
|
||||
if (query.Categories.Contains(TorznabCatType.Movies.ID))
|
||||
qc.Add("filter_cat[1]", "1");
|
||||
{
|
||||
qc.Add("filter_cat[1]", "1"); // HD Movies
|
||||
qc.Add("filter_cat[2]", "1"); // SD Movies
|
||||
}
|
||||
|
||||
if (query.Categories.Contains(TorznabCatType.TV.ID))
|
||||
qc.Add("filter_cat[2]", "1");
|
||||
if (query.Categories.Contains(TorznabCatType.Other.ID))
|
||||
qc.Add("filter_cat[3]", "1");
|
||||
{
|
||||
qc.Add("filter_cat[3]", "1"); // HD EPISODE
|
||||
qc.Add("filter_cat[4]", "1"); // SD Episode
|
||||
qc.Add("filter_cat[5]", "1"); // HD Season
|
||||
qc.Add("filter_cat[6]", "1"); // SD Season
|
||||
}
|
||||
|
||||
return BrowseUrl + "?" + qc.GetQueryString();
|
||||
}
|
||||
@@ -263,7 +269,7 @@ namespace Jackett.Common.Indexers
|
||||
|
||||
var category = torrent.QuerySelector(".cats_col div").GetAttribute("title");
|
||||
// default to Other
|
||||
int categoryId = TorznabCatType.Other.ID;
|
||||
var categoryId = TorznabCatType.Other.ID;
|
||||
|
||||
if (movies.Any(category.Contains))
|
||||
categoryId = TorznabCatType.Movies.ID;
|
||||
@@ -302,9 +308,9 @@ namespace Jackett.Common.Indexers
|
||||
/*const int USER_COL = 1;*/
|
||||
|
||||
|
||||
string downloadAnchorHref = (downloadAnchor as IHtmlAnchorElement).Href;
|
||||
var downloadAnchorHref = (downloadAnchor as IHtmlAnchorElement).Href;
|
||||
var queryParams = HttpUtility.ParseQueryString(downloadAnchorHref, Encoding.UTF8);
|
||||
string torrentId = queryParams["id"];
|
||||
var torrentId = queryParams["id"];
|
||||
|
||||
var qFiles = row.QuerySelector("td:nth-last-child(" + FILES_COL + ")").TextContent;
|
||||
|
||||
@@ -325,10 +331,10 @@ namespace Jackett.Common.Indexers
|
||||
throw new Exception($"We expected 4 torrent datas.");
|
||||
}
|
||||
|
||||
long size = ReleaseInfo.GetBytes(fileSize);
|
||||
int grabs = int.Parse(snatched, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
int seeders = int.Parse(seeds, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
int leechers = int.Parse(leechs, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
var size = ReleaseInfo.GetBytes(fileSize);
|
||||
var grabs = int.Parse(snatched, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
var seeders = int.Parse(seeds, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
var leechers = int.Parse(leechs, NumberStyles.AllowThousands, CultureInfo.InvariantCulture);
|
||||
var detailsUri = new Uri(DetailsUrl + "?torrentid=" + torrentId);
|
||||
var downloadLink = new Uri(BrowseUrl + "?action=download&id=" + torrentId);
|
||||
|
||||
@@ -352,24 +358,6 @@ namespace Jackett.Common.Indexers
|
||||
};
|
||||
}
|
||||
|
||||
// Changes "Season 1" to "1"
|
||||
private static int? SeasonToNumber(string season)
|
||||
{
|
||||
var seasonMatch = new Regex(@"Season (?<seasonNumber>\d{1,2})").Match(season);
|
||||
if (seasonMatch.Success)
|
||||
return int.Parse(seasonMatch.Groups["seasonNumber"].Value);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Changes "1" to "S01"
|
||||
private static string SeasonNumberToShortSeason(int? season)
|
||||
{
|
||||
if (season == null)
|
||||
return null;
|
||||
return $"S{season:00}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse Error Messages from using CSS classes
|
||||
/// </summary>
|
||||
@@ -379,18 +367,10 @@ namespace Jackett.Common.Indexers
|
||||
{
|
||||
var parser = new HtmlParser();
|
||||
var dom = parser.ParseDocument(response.ContentString);
|
||||
var errorMessage = "Unknown Error";
|
||||
var errorMessage = response.Status == System.Net.HttpStatusCode.Forbidden
|
||||
? dom.QuerySelector(".time").Parent.TextContent.Trim()
|
||||
: dom.QuerySelector(".flash.error").TextContent.Trim();
|
||||
|
||||
switch (response.Status)
|
||||
{
|
||||
case System.Net.HttpStatusCode.Forbidden:
|
||||
errorMessage = dom.QuerySelector(".time").Parent.TextContent.Trim();
|
||||
break;
|
||||
default:
|
||||
errorMessage = dom.QuerySelector(".flash.error").TextContent.Trim();
|
||||
break;
|
||||
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user