Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# web scraping get images from specific url

static void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    WebBrowser browser = (WebBrowser)sender;
    HtmlElementCollection collection;
    List<HtmlElement> imgListString = new List<HtmlElement>();
    if (browser != null)
    {
        if (browser.Document != null)
        {
            collection = browser.Document.GetElementsByTagName("img");
            if (collection != null)
            {
                foreach (HtmlElement element in collection)
                {
                    WebClient wClient = new WebClient();
                    string urlDownload = element.GetAttribute("src");
                    wClient.DownloadFile(urlDownload, urlDownload.Substring(urlDownload.LastIndexOf('/')));
                }
            }
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: protected override void OnExiting(Object sender, EventArgs args) { base.OnExiting(sender, args); Environment.Exit(Environment.ExitCode); } 
Csharp :: c++ Write a program to reverse an array or string 
Csharp :: assetfinder 
Csharp :: c# write line variable 
Csharp :: transform.rotate unity 2d 
Csharp :: c# second last index 
Csharp :: freelance 
Csharp :: multithreading in .net core 
Csharp :: how to make a enemy in unity 
Csharp :: MailChimp C# Api calls 
Csharp :: stackpanel opacity mask from resources wpf 
Csharp :: block nulltarge tpl dataflow 
Csharp :: c# an object on upper level cannot be added to an object 
Html :: You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0). 
Html :: marquee speed 
Html :: html starter code 
Html :: bootstrap cdn link 
Html :: bootstrap Bootstrap link 
Html :: Javascript getelementbyid hide element 
Html :: space character in react html 
Html :: input type file csv only 
Html :: difference between name and value in html 
Html :: gender selection in html 
Html :: confuse your browser in html 
Html :: twig join 
Html :: json placeholder limit 
Html :: html ö 
Html :: html implement button send email 
Html :: js add class when hover 
Html :: elementor text control 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =