From 43381a9851448f780d8e1800a2f6dc9e505db10a Mon Sep 17 00:00:00 2001 From: kaso17 Date: Wed, 18 Jan 2017 21:17:45 +0100 Subject: [PATCH] Cardigann: Add support for selector inputs --- src/Jackett/Indexers/CardigannIndexer.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Jackett/Indexers/CardigannIndexer.cs b/src/Jackett/Indexers/CardigannIndexer.cs index c9a51aa61..641880cbb 100644 --- a/src/Jackett/Indexers/CardigannIndexer.cs +++ b/src/Jackett/Indexers/CardigannIndexer.cs @@ -80,6 +80,7 @@ namespace Jackett.Indexers public string Form { get; set; } public bool Selectors { get; set; } = false; public Dictionary Inputs { get; set; } + public Dictionary Selectorinputs { get; set; } public List Error { get; set; } public pageTestBlock Test { get; set; } public captchaBlock Captcha { get; set; } @@ -472,6 +473,21 @@ namespace Jackett.Indexers pairs[input] = value; } + // selector inputs + foreach (var Selectorinput in Login.Selectorinputs) + { + string value = null; + try + { + value = handleSelector(Selectorinput.Value, landingResultDocument.FirstElementChild); + pairs[Selectorinput.Key] = value; + } + catch (Exception ex) + { + throw new Exception(string.Format("Error while parsing selector input={0}, selector={1}, value={2}: {3}", Selectorinput.Key, Selectorinput.Value.Selector, value, ex.Message)); + } + } + // automatically solve simpleCaptchas, if used var simpleCaptchaPresent = landingResultDocument.QuerySelector("script[src*=\"simpleCaptcha\"]"); if(simpleCaptchaPresent != null)