Exemplo n.º 1
0
        protected override void SaveFile(string content)
        {
            var html = new HtmlDocument();

            Console.WriteLine("Le header de la requete pour le site " + Uri + " est : ");
            Console.WriteLine(Header + "\n");
            html.LoadHtml(content);
            html.Save("page.html");
            foreach (var imageUrl in GetAllImageUrl(html))
            {
                Console.WriteLine("Download de l'image {0}", imageUrl);
                Uri url;
                if (imageUrl.StartsWith("http"))
                {
                    url = new Uri(imageUrl);
                }
                else
                {
                    if (imageUrl.StartsWith("//"))
                    {
                        url = new Uri("http:" + imageUrl);
                    }
                    else
                    {
                        url = new Uri("http://" + Uri.Host + imageUrl);
                    }
                }
                var image = new ImageFromInternet(url);
                image.Download();
            }
        }
Exemplo n.º 2
0
 protected override void SaveFile(string content)
 {
     var html = new HtmlDocument();
     Console.WriteLine("Le header de la requete pour le site " + Uri + " est : ");
     Console.WriteLine(Header+"\n");
     html.LoadHtml(content);
     html.Save("page.html");
     foreach (var imageUrl in GetAllImageUrl(html))
     {
         Console.WriteLine("Download de l'image {0}",imageUrl);
         Uri url;
         if (imageUrl.StartsWith("http"))
         {
             url = new Uri(imageUrl);
         }
         else
         {
             if (imageUrl.StartsWith("//"))
                 url = new Uri("http:"+imageUrl);
             else
                 url = new Uri("http://" + Uri.Host + imageUrl);
         }
         var image = new ImageFromInternet(url);
         image.Download();
     }
 }