c# find image in html and download them

后端 未结 4 1999
予麋鹿
予麋鹿 2020-12-30 18:21

i want download all images stored in html(web page) , i dont know how much image will be download , and i don`t want use \"HTML AGILITY PACK\"

i search in google bu

4条回答
  •  执念已碎
    2020-12-30 18:42

    You can use a WebBrowser control and extract the HTML from that e.g.

    System.Windows.Forms.WebBrowser objWebBrowser = new System.Windows.Forms.WebBrowser();
    objWebBrowser.Navigate(new Uri("your url of html document"));
    System.Windows.Forms.HtmlDocument objDoc = objWebBrowser.Document;
    System.Windows.Forms.HtmlElementCollection aColl = objDoc.All.GetElementsByName("IMG");
    ...
    

    or directly invoke the IHTMLDocument family of COM interfaces

提交回复
热议问题