HtmlAgilityPack - 不加载所有图像

时间:2014-09-13 21:46:04

标签: c# html parsing html-agility-pack

我试图从网站上获取图片。

HtmlWeb html = new HtmlWeb();
HtmlDocument htmldoc = html.Load("http://www.inc.com/christine-lagorio/fashion-week-wearable-technology.html");
var img = htmldoc.DocumentNode.SelectNodes("//*[@id='articleheaderimage']/img");

问题是img是空的,尽管它在HTML中。

所以我去检查图标签InnerHtml。

var figure = htmldoc.DocumentNode.SelectNodes("//figure");

似乎img标签转换为空格。

以下是一些InnerHtml

<div id="articleheaderimage" class="picture inc_editable inc_editable_image" data-editor-class="ImageEditor" data-label="Main Image" data-content-type="article" data-content-id="61627" data-fieldname="image" data-parent-id="wrappercontainer">
<!-- the image tag supposed to be here -->
<span class="smallest small-between-medium" data-src="http://www.inc.com/uploaded_files/image/640x290/wearable-technology_39857.jpg" data-src-x2="http://www.inc.com/uploaded_files/image/640x290/wearable-technology_39857.jpg"></span>

我需要做什么才能获得img标签?

0 个答案:

没有答案