Пример #1
0
        // public async Task LoadEmailPaqe(string link)
        // {
        //     try
        //     {
        //         LoadPage loadPage = new LoadPage();
        //         var pageHtml = await loadPage.load(link);
        //         Console.WriteLine(link);
        //         Console.WriteLine(pageHtml);
        //         Console.WriteLine("\n\n\n\n\n\n\n\n");

        //         typePage.Add(pageHtml);
        //     }
        //     catch (System.Exception)
        //     {

        //     }

        // }

        public static async Task GelTypes()
        {
            LoadPage loadPage  = new LoadPage();
            var      typesPage = await loadPage.load("https://ecomotive.ir/startups-list");

            Program.TypesPage = typesPage;
        }
Пример #2
0
        public async Task LoadTypePaqe(string link)
        {
            try
            {
                LoadPage loadPage = new LoadPage();
                await Task.Delay(random.Next(0, 5) * 5000 + 1);

                var pageHtml = await loadPage.load(link);

                if (pageHtml.Contains("Server Error"))
                {
                    Console.WriteLine("server error {0}", link);
                    await LoadTypePaqe(link);
                }
                else
                {
                    typePage.Add(pageHtml);
                    Console.WriteLine("success in link {0}", link);
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine("problem in link {0} message: {1}", link, e.InnerException != null ? e.InnerException.Message : e.Message);
                await LoadTypePaqe(link);
            }
        }