我刚刚下载了 HTMLAgilityPack,文档没有任何示例。
我正在寻找一种从网站下载所有图像的方法。地址字符串,而不是物理图像。
<img src="blabalbalbal.jpeg" />
我需要提取每个 img 标签的来源。我只是想了解一下图书馆以及它可以提供什么。每个人都说这是完成这项工作的最佳工具。
编辑
public void GetAllImages()
{
WebClient x = new WebClient();
string source = x.DownloadString(@"http://www.google.com");
HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
document.Load(source);
//I can't use the Descendants method. It doesn't appear.
var ImageURLS = document.desc
.Select(e => e.GetAttributeValue("src", null))
.Where(s => !String.IsNullOrEmpty(s));
}