mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Cardigann: set referer on captcha request
This commit is contained in:
@@ -357,14 +357,14 @@ namespace Jackett.Indexers
|
||||
return response.Content;
|
||||
}
|
||||
|
||||
protected async Task<WebClientByteResult> RequestBytesWithCookiesAndRetry(string url, string cookieOverride = null, RequestType method = RequestType.GET)
|
||||
protected async Task<WebClientByteResult> RequestBytesWithCookiesAndRetry(string url, string cookieOverride = null, RequestType method = RequestType.GET, string referer = null)
|
||||
{
|
||||
Exception lastException = null;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RequestBytesWithCookies(url, cookieOverride, method);
|
||||
return await RequestBytesWithCookies(url, cookieOverride, method, referer);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -416,13 +416,14 @@ namespace Jackett.Indexers
|
||||
throw lastException;
|
||||
}
|
||||
|
||||
protected async Task<WebClientByteResult> RequestBytesWithCookies(string url, string cookieOverride = null, RequestType method = RequestType.GET)
|
||||
protected async Task<WebClientByteResult> RequestBytesWithCookies(string url, string cookieOverride = null, RequestType method = RequestType.GET, string referer = null)
|
||||
{
|
||||
var request = new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = url,
|
||||
Type = method,
|
||||
Cookies = cookieOverride ?? CookieHeader,
|
||||
Referer = referer,
|
||||
Encoding = Encoding
|
||||
};
|
||||
|
||||
|
@@ -653,7 +653,7 @@ namespace Jackett.Indexers
|
||||
var captchaElement = landingResultDocument.QuerySelector(Captcha.Image);
|
||||
if (captchaElement != null) {
|
||||
var CaptchaUrl = resolvePath(captchaElement.GetAttribute("src"));
|
||||
var captchaImageData = await RequestBytesWithCookies(CaptchaUrl.ToString(), landingResult.Cookies);
|
||||
var captchaImageData = await RequestBytesWithCookies(CaptchaUrl.ToString(), landingResult.Cookies, RequestType.GET, LoginUrl.ToString());
|
||||
var CaptchaImage = new ImageItem { Name = "Captcha Image" };
|
||||
var CaptchaText = new StringItem { Name = "Captcha Text" };
|
||||
|
||||
|
Reference in New Issue
Block a user