Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("(1) Crawl a web page and extract one of the following:\n" +
                              "\t-Product - price information(*)\n" +
                              "\t-Phone numbers\n" +
                              "\t-Email adresses\n" +
                              "\t-Images\n" +
                              "(2) Crawl a web page and extract all information of the chosen category.\n" +
                              "(3) Crawl all the web pages from a root website.\n" +
                              "(4) Display the top N category based on a criteria to the console.");

            var root      = "https://www.quickmobile.ro/laptopuri/laptopuri";
            var rootLinks = ExtractLinks(root);

            /*
             * for(var i = 0; i < 10; i++)
             * {
             *  DisplayProducts(rootLinks.ElementAt(i));
             * }
             */
            Console.Write("\nCollecting top products in progress ");
            for (var i = 0; i < 10; i++)
            {
                CollectProducts(rootLinks.ElementAt(i));
                Console.Write("---");
            }
            Console.WriteLine(" Finish!\n");

            AllProducts = AllProducts.Distinct().ToList();
            var d = AllProducts.OrderByDescending(p => p.Price).ThenBy(p => p.Name).ToList();

            for (int i = 0; i < 10; i++)
            {
                DisplayProduct(d.ElementAt(i));
            }

            Console.WriteLine("\nSuccess!");
            Console.ReadLine();
        }