Esempio n. 1
0
        private HtmlDocument LoadHtmlFromUrl(string url, Encoding encoding)
        {
            string htmlStr = Downloador.Post(url);

            if (string.IsNullOrEmpty(htmlStr))
            {
                return(null);
            }
            HtmlDocument htmlDoc = new HtmlDocument();

            htmlDoc.LoadHtml(htmlStr);
            return(htmlDoc);
        }
Esempio n. 2
0
        public void Crawl(string url)
        {
            //Downloador.DownloadAsync(
            //    url,
            //    str =>
            //    {
            //        using (StreamWriter writer = new StreamWriter("data.txt"))
            //        {
            //            writer.Write(str);

            //        }

            //    });
            string str = Downloador.Download(url);

            Console.WriteLine(str);
            Console.ReadKey();
        }
Esempio n. 3
0
 public Spider()
 {
     Downloador = new Downloador();
 }