使用 HtmlAgilityPack 获取 img src 值

grab img src value using HtmlAgilityPack

我正在尝试使用以下 HtmlAgilityPack 获取 img src 的值,但是这个 returns 错误是找不到对象。我在这里做错了什么?

c#:

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

string imgvalue = htmlDoc.DocumentNode.SelectSingleNode("//div[@clsss='a-column a-span3 a-spacing-micro imageThumb thumb']/img").Attributes["src"].Value;

Html:

<div class="a-column a-span3 a-spacing-micro imageThumb thumb">
<img src="https://images-na.ssl-images-amazon.com/images/I/41RHFEpd-nS._AC_SX60_CR,0,0,60,60_.jpg">
</div>

将 clsss 更改为 class,然后重试。应该work

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

string imgvalue = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='a-column a-span3 a-spacing-micro imageThumb thumb']/img").Attributes["src"].Value;