From c14f32482cb7441c0173b239b13878571a8b1b51 Mon Sep 17 00:00:00 2001 From: Diego Heras Date: Sun, 17 Apr 2022 09:49:25 +0200 Subject: [PATCH] anidex: fix ddos-guard challenge with flaresolverr. closes #1335 (#13171) Required FlareSolverr >= 2.2.4 --- src/Jackett.Common/Indexers/Anidex.cs | 24 +++++------------------- src/Jackett.Common/Jackett.Common.csproj | 2 +- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/Jackett.Common/Indexers/Anidex.cs b/src/Jackett.Common/Indexers/Anidex.cs index 4490f8be5..ce6545dbb 100644 --- a/src/Jackett.Common/Indexers/Anidex.cs +++ b/src/Jackett.Common/Indexers/Anidex.cs @@ -65,6 +65,11 @@ namespace Jackett.Common.Indexers AddCategoryMapping(15, TorznabCatType.XXX, "Adult Video"); AddCategoryMapping(16, TorznabCatType.Other, "Other"); + configData.AddDynamic( + "DDoS-Guard", + new DisplayInfoConfigurationItem("", "This site may use DDoS-Guard Protection, therefore Jackett requires FlareSolverr to access it.") + ); + AddLanguageConfiguration(); // Configure the sort selects @@ -182,13 +187,6 @@ namespace Jackett.Common.Indexers var searchUri = GetAbsoluteUrl("?" + queryParameters.GetQueryString() + catString + langIds); var response = await RequestWithCookiesAndRetryAsync(searchUri.AbsoluteUri); - // Check for DDOS Guard - if (response.Status == HttpStatusCode.Forbidden) - { - await ConfigureDDoSGuardCookieAsync(); - response = await RequestWithCookiesAndRetryAsync(searchUri.AbsoluteUri); - } - if (response.Status != HttpStatusCode.OK) throw new WebException($"Anidex search returned unexpected result. Expected 200 OK but got {response.Status}.", WebExceptionStatus.ProtocolError); @@ -243,18 +241,6 @@ namespace Jackett.Common.Indexers } } - private async Task ConfigureDDoSGuardCookieAsync() - { - const string ddosPostUrl = "https://check.ddos-guard.net/check.js"; - var response = await RequestWithCookiesAsync(ddosPostUrl, string.Empty); - if (response.Status != HttpStatusCode.OK) - throw new WebException($"Unexpected DDOS Guard response: Status: {response.Status}", WebExceptionStatus.ProtocolError); - if (response.IsRedirect) - throw new WebException($"Unexpected DDOS Guard response: Redirect: {response.RedirectingTo}", WebExceptionStatus.UnknownError); - if (string.IsNullOrWhiteSpace(response.Cookies)) - throw new WebException("Unexpected DDOS Guard response: Empty cookie", WebExceptionStatus.ReceiveFailure); - } - private static TResult ParseValueFromRow(IElement row, string propertyName, string selector, Func parseFunction) { diff --git a/src/Jackett.Common/Jackett.Common.csproj b/src/Jackett.Common/Jackett.Common.csproj index 7a09175b1..a4afe1272 100644 --- a/src/Jackett.Common/Jackett.Common.csproj +++ b/src/Jackett.Common/Jackett.Common.csproj @@ -15,7 +15,7 @@ - +