New: (Cardigann) Optional login selectorinputs and getselectorinputs

This commit is contained in:
Bogdan
2024-06-22 04:12:37 +03:00
parent e2ce6437e9
commit fedebca5e1
2 changed files with 25 additions and 22 deletions
@@ -139,20 +139,13 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
{
var selectorSelector = ApplyGoTemplateText(selector.Selector, variables);
if (dom.Matches(selectorSelector))
{
selection = dom;
}
else
{
selection = QuerySelector(dom, selectorSelector);
}
selection = dom.Matches(selectorSelector) ? dom : QuerySelector(dom, selectorSelector);
if (selection == null)
{
if (required)
{
throw new Exception(string.Format("Selector \"{0}\" didn't match {1}", selectorSelector, dom.ToHtmlPretty()));
throw new Exception($"Selector \"{selectorSelector}\" didn't match {dom.ToHtmlPretty()}");
}
return null;
@@ -195,7 +188,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
{
if (required)
{
throw new Exception(string.Format("Attribute \"{0}\" is not set for element {1}", selector.Attribute, selection.ToHtmlPretty()));
throw new Exception($"Attribute \"{selector.Attribute}\" is not set for element {selection.ToHtmlPretty()}");
}
return null;