只需一步,快速开始
分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程
HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成
HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子
HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = "http://www.sufeinet.com" }; HtmlDocument html = new HtmlDocument(); html.LoadHtml(http.GetHtml(item)); HtmlAgilityPack.HtmlNode htmlNode = html.DocumentNode; //要取出的Xpath标签 HtmlAgilityPack.HtmlNode div = htmlNode.SelectSingleNode(".//*[@id='nv_forum']/div[6]/div[1]/a[1]");
使用道具 举报
SillyPGM 发表于 2013-1-25 16:43 我是沙发,Xpath,百度了一下很强大,希望飞哥继续更新这方面的东西。
HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = "http://www.sufeinet.com" }; HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(http.GetHtml(item).Html); HtmlAgilityPack.HtmlNode htmlNode = html.DocumentNode; HtmlAgilityPack.HtmlNode div = htmlNode.SelectSingleNode(".//*[@id='nv_forum']/div[6]/div[1]/a[1]");
sandy1231 发表于 2014-1-8 19:36 刚接触这个类 全是英文看不懂,不过按飞哥的代码写 会报错 为啥 ? [mw_shl_code=csharp,true] HttpHelper ...
站长苏飞 发表于 2014-1-8 20:01 什么错
private void button1_Click(object sender, EventArgs e) { HttpHelper http = new HttpHelper(); HttpItem item = new HttpItem() { URL = "http://www.sufeinet.com" }; HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(http.GetHtml(item).Html); HtmlAgilityPack.HtmlNode htmlNode = html.DocumentNode; HtmlAgilityPack.HtmlNode div = htmlNode.SelectSingleNode(".//*[@id='nv_forum']/div[6]/div[1]/a[1]"); richTextBox1.Text = div.OuterHtml; }
本版积分规则 发表回复 回帖后跳转到最后一页
|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)
GMT+8, 2025-2-22 16:54
© 2014-2021