From 634a860f5c423e1b1920c851dd635d63b3a07289 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 14 Sep 2017 15:00:33 +0200 Subject: [PATCH] DigitalHive: Captcha is optional now --- src/Jackett/Indexers/DigitalHive.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Jackett/Indexers/DigitalHive.cs b/src/Jackett/Indexers/DigitalHive.cs index 6bb91620d..b54d86361 100644 --- a/src/Jackett/Indexers/DigitalHive.cs +++ b/src/Jackett/Indexers/DigitalHive.cs @@ -94,11 +94,24 @@ namespace Jackett.Indexers var loginPage = await RequestStringWithCookies(LoginUrl, configData.CookieHeader.Value); CQ cq = loginPage.Content; string recaptchaSiteKey = cq.Find(".g-recaptcha").Attr("data-sitekey"); - var result = this.configData; - result.CookieHeader.Value = loginPage.Cookies; - result.Captcha.SiteKey = recaptchaSiteKey; - result.Captcha.Version = "2"; - return result; + if (recaptchaSiteKey != null) + { + var result = this.configData; + result.CookieHeader.Value = loginPage.Cookies; + result.Captcha.SiteKey = recaptchaSiteKey; + result.Captcha.Version = "2"; + return result; + } + else + { + var result = new ConfigurationDataBasicLogin(); + result.SiteLink.Value = configData.SiteLink.Value; + result.Instructions.Value = configData.Instructions.Value; + result.Username.Value = configData.Username.Value; + result.Password.Value = configData.Password.Value; + result.CookieHeader.Value = loginPage.Cookies; + return result; + } } public override async Task ApplyConfiguration(JToken configJson)