Hello, I use for HAP to parse certain pages. It seems that everything is working fine, including the search for Kinopoisk, but here something does not work directly with the page of the film
using (HttpClientHandler handler = new HttpClientHandler() { AllowAutoRedirect = true, AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate }) { using (HttpClient client = new HttpClient(handler) { BaseAddress = new Uri("https://www.kinopoisk.ru/film/") }) { HtmlAgilityPack.HtmlDocument HD = new HtmlAgilityPack.HtmlDocument(); HD.LoadHtml(client.GetStringAsync("839219").Result); //ищем заголовок фильма var kinopoisk = HD.DocumentNode.SelectSingleNode("//title"); if (kinopoisk != null) { MessageBox.Show(kinopoisk.InnerText); } } }
839219 is the id of the movie on the cinema search. Can someone tell me what I'm doing wrong? Parsing works with other sites of this kind, but not here ...
GetStringAsync
method, it should be executed asynchronously. As a result, an empty string can be passed to theLoadHtml
method. - Stepan Kasyanenko