开发者

C# htmlagility pack , save image from a URL

I know there is a way to save images using WebClient, however, I pr开发者_JS百科efer to use HTMLAgility pack, does anybody have a good example of how to do that?


HTML Agility Pack is used for parsing HTML, not for sending HTTP requests and saving images or whatever. So once you have used HTML Agility Pack to parse the HTML and find the url of the image simply use a WebClient to download it from its location:

using (var client = new WebClient())
{
    client.DownloadFile(urlObtainedWithHtmlAgilityPack, "foo");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜