I am writing a little Download-Roboter that is looking for links in the lower layers for myself.
I need to find all the links in the html page (links to .jpg files, as well as links to .pgn, .pdf, .html, .... - files)
I use html-agilitypack to find all a-href links.
Code example:
foreach (HtmlNode link in htmlDocument.DocumentNode.SelectNodes("//a[@href]"))
{
HtmlAttribute attribute = link.Attributes["href"];
links.Add(attribute.Value);
}
But I also want to find the data urls.
What XPath syntax should I use to search for URLs. Example url data in htmlcode:
<div class="cbreplay" data-url="2012\edmonton\partien.pgn"></div>
I need "2012 \ edmonton \ partien.pgn" from this example. How can I figure this out with XPath syntax?
Best greetings, if I made some bad mistakes, tell me. This is my first question.
source
share