Cardigann: apply template engine to download/selector

This commit is contained in:
kaso17 2017-12-18 18:11:11 +01:00
parent 26258f2768
commit 97a5d58f13
1 changed files with 3 additions and 2 deletions

View File

@ -1510,16 +1510,17 @@ namespace Jackett.Indexers
}
if (Download.Selector != null)
{
var selector = applyGoTemplateText(Download.Selector, variables);
var response = await RequestStringWithCookies(link.ToString());
if (response.IsRedirect)
response = await RequestStringWithCookies(response.RedirectingTo);
var results = response.Content;
var SearchResultParser = new HtmlParser();
var SearchResultDocument = SearchResultParser.Parse(results);
var DlUri = SearchResultDocument.QuerySelector(Download.Selector);
var DlUri = SearchResultDocument.QuerySelector(selector);
if (DlUri != null)
{
logger.Debug(string.Format("CardigannIndexer ({0}): Download selector {1} matched:{2}", ID, Download.Selector, DlUri.ToHtmlPretty()));
logger.Debug(string.Format("CardigannIndexer ({0}): Download selector {1} matched:{2}", ID, selector, DlUri.ToHtmlPretty()));
var href = DlUri.GetAttribute("href");
href = applyFilters(href, Download.Filters, variables);
link = resolvePath(href);