Fixed: (Cardigann) Change UseBeforeResponse to Usebeforeresponse

pull/1467/head v1.3.0.2757
Bogdan 2 years ago
parent b85679de56
commit 6ec761c217

@ -190,14 +190,14 @@ namespace NzbDrone.Core.Indexers.Cardigann
{ {
public SelectorField Hash { get; set; } public SelectorField Hash { get; set; }
public SelectorField Title { get; set; } public SelectorField Title { get; set; }
public bool UseBeforeResponse { get; set; } public bool Usebeforeresponse { get; set; }
} }
public class SelectorField public class SelectorField
{ {
public string Selector { get; set; } public string Selector { get; set; }
public string Attribute { get; set; } public string Attribute { get; set; }
public bool UseBeforeResponse { get; set; } public bool Usebeforeresponse { get; set; }
public List<FilterBlock> Filters { get; set; } public List<FilterBlock> Filters { get; set; }
} }

@ -712,8 +712,6 @@ namespace NzbDrone.Core.Indexers.Cardigann
{ {
var requestLinkStr = ResolvePath(ApplyGoTemplateText(request.Path, variables)).ToString(); var requestLinkStr = ResolvePath(ApplyGoTemplateText(request.Path, variables)).ToString();
_logger.Debug("CardigannIndexer ({0}): handleRequest() requestLinkStr= {1}", _definition.Id, requestLinkStr);
Dictionary<string, string> pairs = null; Dictionary<string, string> pairs = null;
var queryCollection = new NameValueCollection(); var queryCollection = new NameValueCollection();
@ -771,9 +769,12 @@ namespace NzbDrone.Core.Indexers.Cardigann
.WithRateLimit(_rateLimit.TotalSeconds) .WithRateLimit(_rateLimit.TotalSeconds)
.Build(); .Build();
_logger.Debug("CardigannIndexer ({0}): handleRequest() httpRequest={1}", _definition.Id, httpRequest);
var response = await HttpClient.ExecuteProxiedAsync(httpRequest, Definition); var response = await HttpClient.ExecuteProxiedAsync(httpRequest, Definition);
_logger.Debug("CardigannIndexer ({0}): handleRequest() remote server returned {1}", _definition.Id, response.StatusCode); _logger.Debug("CardigannIndexer ({0}): handleRequest() remote server returned {1}", _definition.Id, response.StatusCode);
return response; return response;
} }
@ -822,7 +823,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
{ {
try try
{ {
if (!download.Infohash.UseBeforeResponse || download.Before == null || response == null) if (!download.Infohash.Usebeforeresponse || download.Before == null || response == null)
{ {
response = await HttpClient.ExecuteProxiedAsync(request, Definition); response = await HttpClient.ExecuteProxiedAsync(request, Definition);
} }
@ -830,13 +831,13 @@ namespace NzbDrone.Core.Indexers.Cardigann
var hash = MatchSelector(response, download.Infohash.Hash, variables); var hash = MatchSelector(response, download.Infohash.Hash, variables);
if (hash == null) if (hash == null)
{ {
throw new CardigannException($"InfoHash selectors didn't match"); throw new CardigannException("InfoHash selectors didn't match hash.");
} }
var title = MatchSelector(response, download.Infohash.Title, variables); var title = MatchSelector(response, download.Infohash.Title, variables);
if (title == null) if (title == null)
{ {
throw new CardigannException($"InfoHash selectors didn't match"); throw new CardigannException("InfoHash selectors didn't match title.");
} }
var magnet = MagnetLinkBuilder.BuildPublicMagnetLink(hash, title); var magnet = MagnetLinkBuilder.BuildPublicMagnetLink(hash, title);
@ -868,7 +869,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
try try
{ {
if (!selector.UseBeforeResponse || download.Before == null || response == null) if (!selector.Usebeforeresponse || download.Before == null || response == null)
{ {
response = await HttpClient.ExecuteProxiedAsync(request, Definition); response = await HttpClient.ExecuteProxiedAsync(request, Definition);
} }
@ -941,8 +942,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
var selectorText = ApplyGoTemplateText(selector.Selector, variables); var selectorText = ApplyGoTemplateText(selector.Selector, variables);
var parser = new HtmlParser(); var parser = new HtmlParser();
var results = response.Content; var resultDocument = parser.ParseDocument(response.Content);
var resultDocument = parser.ParseDocument(results);
var element = resultDocument.QuerySelector(selectorText); var element = resultDocument.QuerySelector(selectorText);
if (element == null) if (element == null)

Loading…
Cancel
Save