0

I am trying to grab an img url but I keep getting stuck with the inner or outterhtml which is still kinda a mess. I am grabbing it with

HtmlNode htmltable = mydoc.DocumentNode.SelectSingleNode("(//*[@id='mw-content-text']/figure[1]/a/img)");

that still leaves me with <img alt =\"blah\"src=\"http://imageIwant.png\">" string is there an easy way to parse out all the extra and just have http://imageIwant.png

TankCR
  • 61
  • 1
  • 7

1 Answers1

1

The HtmlNode has attributes namevalue collection which you can cycle through and look for src attribute and that will give the url of the image.

htmltable.Attributes['src'] will give the image url.

Antony Francis
  • 304
  • 1
  • 7