private IHtmlCollection <IElement> GetElements(IHtmlDocument dom, ScrapyRule rule) { if (!string.IsNullOrEmpty(rule.Selector)) { return(dom.QuerySelectorAll(rule.Selector)); } if (rule.Selectors != null && rule.Selectors.Any()) { foreach (var selector in rule.Selectors) { var elements = dom.QuerySelectorAll(selector); if (elements.Length > 0) { return(elements); } } } return(null); }
public ScrapySource(ScrapyRule rule) : this(new List <ScrapyRule> { rule }) { }