c# 爬虫和组件HtmlAgilityPack处理html

测试当前爬虫的User-Agent:http://www.whatismyuseragent.net/

大佬的博客地址:https://www.cnblogs.com/jjg0519/p/6702747.html

然后拿着demo去弄,发现被重定向了

然后就看

把大佬的代码那个禁止重定向弄掉就ok了

然后就能抓取到数据了

处理获取的html可以用组件HtmlAgilityPack

HtmlAgilityPack.HtmlDocument hd = new HtmlAgilityPack.HtmlDocument();
 hd.LoadHtml(html);
 string amount = hd.DocumentNode.SelectSingleNode("//*[@id='gz_gszzl']").InnerText;

HtmlNode htmlNode = hd.DocumentNode.SelectSingleNode("//*[@class='ui-table-hover']");
原文地址:https://www.cnblogs.com/shuaimeng/p/10684238.html