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;
|
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;
|
Exception lastException = null;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await RequestBytesWithCookies(url, cookieOverride, method);
|
return await RequestBytesWithCookies(url, cookieOverride, method, referer);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -416,13 +416,14 @@ namespace Jackett.Indexers
|
|||||||
throw lastException;
|
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()
|
var request = new Utils.Clients.WebRequest()
|
||||||
{
|
{
|
||||||
Url = url,
|
Url = url,
|
||||||
Type = method,
|
Type = method,
|
||||||
Cookies = cookieOverride ?? CookieHeader,
|
Cookies = cookieOverride ?? CookieHeader,
|
||||||
|
Referer = referer,
|
||||||
Encoding = Encoding
|
Encoding = Encoding
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -653,7 +653,7 @@ namespace Jackett.Indexers
|
|||||||
var captchaElement = landingResultDocument.QuerySelector(Captcha.Image);
|
var captchaElement = landingResultDocument.QuerySelector(Captcha.Image);
|
||||||
if (captchaElement != null) {
|
if (captchaElement != null) {
|
||||||
var CaptchaUrl = resolvePath(captchaElement.GetAttribute("src"));
|
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 CaptchaImage = new ImageItem { Name = "Captcha Image" };
|
||||||
var CaptchaText = new StringItem { Name = "Captcha Text" };
|
var CaptchaText = new StringItem { Name = "Captcha Text" };
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user