Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get img/src or a/hrefs using Html Agility Pack?

I want to use the HTML agility pack to parse image and href links from a HTML page,but I just don't know much about XML or XPath.Though having looking up help documents in many web sites,I just can't solve the problem.In addition,I use C# in VisualStudio 2005.And I just can't speak English fluently,so,I will give my sincere thanks to the one can write some helpful codes.

like image 441
iShow Avatar asked Jan 29 '11 08:01

iShow


1 Answers

var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);

string name = htmlDoc.DocumentNode
    .SelectNodes("//td/input")
    .First()
    .Attributes["value"].Value;

Source: https://html-agility-pack.net/select-nodes

like image 170
DIGITALCRIMINAL Avatar answered Oct 14 '22 08:10

DIGITALCRIMINAL