Парсер на HtmlAgilityPack содержит ошибки - C#
Формулировка задачи:
Есть специалисты, котроые могут посмотреть в чем ошибка?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;
using System.Net;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
WebClient webClient = new WebClient();
string user = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C; .NET4.0E)";
webClient.Headers.Add("user-agent", user);
string html = webClient.DownloadString("http://kinoprosmotr.net");
doc.LoadHtml(html);
HtmlAgilityPack.HtmlNodeCollection node = doc.DocumentNode.SelectNodes("//div[@class='teaser_desc']");
foreach (var item in node)
{
string data = item.InnerHtml;
Console.WriteLine("Success!", data);
}
Console.ReadKey();
}
}
}Решение задачи: «Парсер на HtmlAgilityPack содержит ошибки»
textual
Листинг программы
string html = webClient.DownloadString("http://kinoprosmotr.net");