public override async Task<ConfigurationData> GetConfigurationForSetup() { var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty); string recaptchaSiteKey = new Regex(@"loginwidget', \{[\s]{4,30}'sitekey' : '([0-9A-Za-z-]{5,60})',[\s]{4,30}'theme'").Match(loginPage.Content).Groups[1].ToString().Trim(); var result = new ConfigurationDataRecaptchaLogin(); result.CookieHeader.Value = loginPage.Cookies; result.Captcha.SiteKey = recaptchaSiteKey; return result; }
public override async Task<ConfigurationData> GetConfigurationForSetup() { var loginPage = await RequestStringWithCookies(StartPageUrl, string.Empty); CQ cq = loginPage.Content; var result = new ConfigurationDataRecaptchaLogin(); CQ recaptcha = cq.Find(".g-recaptcha").Attr("data-sitekey"); if(recaptcha.Length != 0) // recaptcha not always present in login form, perhaps based on cloudflare uid or just phase of the moon { result.CookieHeader.Value = loginPage.Cookies; result.Captcha.SiteKey = cq.Find(".g-recaptcha").Attr("data-sitekey"); return result; } else { var stdResult = new ConfigurationDataBasicLogin(); stdResult.CookieHeader.Value = loginPage.Cookies; return stdResult; } }
public override async Task<ConfigurationData> GetConfigurationForSetup() { var loginPage = await RequestStringWithCookies(StartPageUrl, string.Empty); CQ cq = loginPage.Content; var result = new ConfigurationDataRecaptchaLogin(); result.CookieHeader.Value = loginPage.Cookies; result.Captcha.SiteKey = cq.Find(".g-recaptcha").Attr("data-sitekey"); return result; }