cardigann: show request url with params in logs (#14067)

This commit is contained in:
Bogdan 2023-02-22 15:33:01 +02:00 committed by GitHub
parent b484be361a
commit b7646ec2b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -787,7 +787,9 @@ namespace Jackett.Common.Indexers
{ {
throw new NotImplementedException("Login method " + Definition.Login.Method + " not implemented"); throw new NotImplementedException("Login method " + Definition.Login.Method + " not implemented");
} }
logger.Debug(string.Format("CardigannIndexer ({0}): Cookies after login: {1}", Id, CookieHeader));
logger.Debug($"CardigannIndexer ({Id}): Cookies after login: {CookieHeader}");
return true; return true;
} }
@ -1708,7 +1710,6 @@ namespace Jackett.Common.Indexers
protected async Task<WebResult> handleRequest(requestBlock request, Dictionary<string, object> variables = null, string referer = null) protected async Task<WebResult> handleRequest(requestBlock request, Dictionary<string, object> variables = null, string referer = null)
{ {
var requestLinkStr = resolvePath(applyGoTemplateText(request.Path, variables)).ToString(); var requestLinkStr = resolvePath(applyGoTemplateText(request.Path, variables)).ToString();
logger.Debug($"CardigannIndexer ({Id}): handleRequest() requestLinkStr= {requestLinkStr}");
Dictionary<string, string> pairs = null; Dictionary<string, string> pairs = null;
var queryCollection = new NameValueCollection(); var queryCollection = new NameValueCollection();
@ -1736,11 +1737,16 @@ namespace Jackett.Common.Indexers
{ {
if (!requestLinkStr.Contains("?")) if (!requestLinkStr.Contains("?"))
requestLinkStr += "?"; requestLinkStr += "?";
requestLinkStr += queryCollection.GetQueryString(Encoding, separator: request.Queryseparator); requestLinkStr += queryCollection.GetQueryString(Encoding, separator: request.Queryseparator);
} }
logger.Debug($"CardigannIndexer ({Id}): handleRequest() requestLinkStr= {requestLinkStr}");
var response = await RequestWithCookiesAndRetryAsync(requestLinkStr, null, method, referer, pairs); var response = await RequestWithCookiesAndRetryAsync(requestLinkStr, null, method, referer, pairs);
logger.Debug($"CardigannIndexer ({Id}): handleRequest() remote server returned {response.Status.ToString()}" + (response.IsRedirect ? " => " + response.RedirectingTo : "")); logger.Debug($"CardigannIndexer ({Id}): handleRequest() remote server returned {response.Status.ToString()}" + (response.IsRedirect ? " => " + response.RedirectingTo : ""));
return response; return response;
} }
@ -1838,6 +1844,7 @@ namespace Jackett.Common.Indexers
if (Download.Method == "post") if (Download.Method == "post")
method = RequestType.POST; method = RequestType.POST;
if (Download.Infohash != null) if (Download.Infohash != null)
{ {
try try
@ -1849,14 +1856,15 @@ namespace Jackett.Common.Indexers
var hash = MatchSelector(response, Download.Infohash.Hash, variables); var hash = MatchSelector(response, Download.Infohash.Hash, variables);
if (hash == null) if (hash == null)
throw new Exception($"InfoHash selectors didn't match"); throw new Exception("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 Exception($"InfoHash selectors didn't match"); throw new Exception("InfoHash selectors didn't match title.");
var magnet = MagnetUtil.InfoHashToPublicMagnet(hash, title); var magnet = MagnetUtil.InfoHashToPublicMagnet(hash, title);
var torrentLink = resolvePath(magnet.AbsoluteUri, link); var torrentLink = resolvePath(magnet.AbsoluteUri, link);
return await base.Download(torrentLink, method, torrentLink.ToString()); return await base.Download(torrentLink, method, torrentLink.ToString());
} }
catch (Exception e) catch (Exception e)