Cardigann: Add support for selector inputs

This commit is contained in:
kaso17 2017-01-18 21:17:45 +01:00
parent 08ef126c01
commit 43381a9851
1 changed files with 16 additions and 0 deletions

View File

@ -80,6 +80,7 @@ namespace Jackett.Indexers
public string Form { get; set; }
public bool Selectors { get; set; } = false;
public Dictionary<string, string> Inputs { get; set; }
public Dictionary<string, selectorBlock> Selectorinputs { get; set; }
public List<errorBlock> 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)