How can i get a List<string> of images from a website link?
<p>I want to build a List of images from a website link and then later also to save/download the images to the hard disk.</p>

<p>This is how im getting the links from a website/url:</p>

<pre><code>private List&lt;string&gt; getLinks(HtmlAgilityPack.HtmlDocument document)
        {

            List&lt;string&gt; mainLinks = new List&lt;string&gt;();
            var linkNodes = document.DocumentNode.SelectNodes("//a[@href]");
            if (linkNodes != null)
            {
                foreach (HtmlNode link in linkNodes)
                {
                    var href = link.Attributes["href"].Value;
                    if (href.StartsWith("http://") ==true || href.StartsWith("https://") ==true || href.StartsWith("www.") ==true) // filter for http 
                    {
                        mainLinks.Add(href);
                    }
                }
            }
            return mainLinks;

        }
</code></pre>

<p>Then im using in this test function to build a List of all the links from the url:</p>

<pre><code>private List&lt;string&gt; test(string url, int levels, DoWorkEventArgs eve)
        {

            HtmlWeb hw = new HtmlWeb();
            List&lt;string&gt; webSites;

                        try
            {
                doc = hw.Load(url);
                webSites = getLinks(doc);
                //retriveImages();
</code></pre>

<p>So webSites wich is a List will have all the link from the main website url fro example if its google.com then in webSites i will have 19 items each one is a link from google.com</p>

<p>And retrieveImages() is:</p>

<pre><code>private void retrieveImages()
        {
            var nodes = doc.DocumentNode.SelectNodes("//img");
            foreach (var node in nodes)
            {
                List&lt;string&gt; images = new List&lt;string&gt;();
                images.Add(node.Name);
            } 

        }
</code></pre>

<p>And retrieveImages() for sure is not good code and also is not working. If im using it moving the // and calling the retrieveImages() nothing happened webSites List is empty.</p>

<p>What i want to do is in the function retrieveImages() to build a list of images from the curretn site/link im in now and then also to download the images to the hard disk the images in the List i built.</p>
