public List<string> GetAllImageSrcs(string str) { HtmlDocument doc = new HtmlDocument(); doc.Load(str.ToStream()); HtmlNodeCollection imgs = new HtmlNodeCollection(doc.DocumentNode.ParentNode); imgs = doc.DocumentNode.SelectNodes("//img"); if (imgs == null || !imgs.Any()) { return null; } var result = imgs.Select(i => @"https://rally1.rallydev.com"+i.Attributes[@"src"].Value).ToList(); return result; }
private static List<HtmlNode> NodesToList(HtmlNodeCollection nodes) { return (nodes != null && nodes.Any()) ? nodes.ToList() : new List<HtmlNode>(); }