C# 如何取得百度指数

XJQ_1 2009-08-09 10:28:58
如 我在百度 搜 CNDN

百度一下,找到相关网页约16,500,000篇,用时0.001秒


这个 16,500,000 如何取得,我用C# 写代码

...全文
890 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
day90 2009-10-25
  • 打赏
  • 举报
回复
没看明白lz要干啥

是问咋统计?

还是问咋取百度的结果?
yyhlove 2009-10-25
  • 打赏
  • 举报
回复
路过 学习下。帮定
xiaoxin4321 2009-10-25
  • 打赏
  • 举报
回复
学习了,~~
十八道胡同 2009-08-10
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 lxcnn 的回复:]
看不太明白需求,先取网页,再分析得到结果?

C# code//通过URL取网页源代码privatestring GetHtmlCode(string url, Encoding encoding)
{
System.Net.HttpWebRequest request= (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
System.Net.WebResponse response= request.GetResponse();
System.IO.Stream resStream= response.GetResponseStream();
System.IO.StreamReader sr=new System.IO.StreamReader(resStream, encoding);string html= (sr.ReadToEnd());
resStream.Close();
sr.Close();return html;
}//调用,解析string html= GetHtmlCode("http://www.baidu.com/s?wd=CNDN", Encoding.GetEncoding("gb2312"));
Regex reg=new Regex(@"百度一下,找到相关网页约(?<count>\d{1,3}(?:,\d{3})*)篇");
Match m= reg.Match(html);if (m.Success)
{
richTextBox2.Text+= m.Groups["count"].Value+"\n";
}
[/Quote]

顶个
laoban108 2009-08-10
  • 打赏
  • 举报
回复
学习。
Dhoopu 2009-08-10
  • 打赏
  • 举报
回复
不懂,友情帮顶!!!
Dhoopu 2009-08-10
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 lxcnn 的回复:]
看不太明白需求,先取网页,再分析得到结果?

C# code//通过URL取网页源代码privatestring GetHtmlCode(string url, Encoding encoding)
{
System.Net.HttpWebRequest request= (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
System.Net.WebResponse response= request.GetResponse();
System.IO.Stream resStream= response.GetResponseStream();
System.IO.StreamReader sr=new System.IO.StreamReader(resStream, encoding);string html= (sr.ReadToEnd());
resStream.Close();
sr.Close();return html;
}//调用,解析string html= GetHtmlCode("http://www.baidu.com/s?wd=CNDN", Encoding.GetEncoding("gb2312"));
Regex reg=new Regex(@"百度一下,找到相关网页约(?<count>\d{1,3}(?:,\d{3})*)篇");
Match m= reg.Match(html);if (m.Success)
{
richTextBox2.Text+= m.Groups["count"].Value+"\n";
}
[/Quote]

貌似这个方法不错嘛,支持下。这样直接把百度的信息抓过来了。准确而方便。
BitCoffee 2009-08-10
  • 打赏
  • 举报
回复
先获取网页源代码,再用正则匹配.
[Quote=引用 5 楼 lxcnn 的回复:]
看不太明白需求,先取网页,再分析得到结果?

C# code//通过URL取网页源代码privatestring GetHtmlCode(string url, Encoding encoding)
{
System.Net.HttpWebRequest request= (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
System.Net.WebResponse response= request.GetResponse();
System.IO.Stream resStream= response.GetResponseStream();
System.IO.StreamReader sr=new System.IO.StreamReader(resStream, encoding);string html= (sr.ReadToEnd());
resStream.Close();
sr.Close();return html;
}//调用,解析string html= GetHtmlCode("http://www.baidu.com/s?wd=CNDN", Encoding.GetEncoding("gb2312"));
Regex reg=new Regex(@"百度一下,找到相关网页约(?<count>\d{1,3}(?:,\d{3})*)篇");
Match m= reg.Match(html);if (m.Success)
{
richTextBox2.Text+= m.Groups["count"].Value+"\n";
}
[/Quote]
-过客- 2009-08-09
  • 打赏
  • 举报
回复
看不太明白需求,先取网页,再分析得到结果?

//通过URL取网页源代码
private string GetHtmlCode(string url, Encoding encoding)
{
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream resStream = response.GetResponseStream();
System.IO.StreamReader sr = new System.IO.StreamReader(resStream, encoding);
string html = (sr.ReadToEnd());
resStream.Close();
sr.Close();
return html;
}
//调用,解析
string html = GetHtmlCode("http://www.baidu.com/s?wd=CNDN", Encoding.GetEncoding("gb2312"));
Regex reg = new Regex(@"百度一下,找到相关网页约(?<count>\d{1,3}(?:,\d{3})*)篇");
Match m = reg.Match(html);
if (m.Success)
{
richTextBox2.Text += m.Groups["count"].Value + "\n";
}
wuyq11 2009-08-09
  • 打赏
  • 举报
回复
这是搜索引擎的抓取功能,爬虫程序,抓取页面可用
webclient,httpwebrequest等
或通过webbrower通过post提交获取页面内容
pengalwin 2009-08-09
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 sql77 的回复:]
C# code这个应该与数据库表进行联系,然后查询匹配的记录行数,时间就计算一下就好了,数据库中也可以查询
STRING SQL="SELECT COUNT(*) FROM TB WHERE COL LIKE '%"+TEXTBOX.TEXT+"%'";
[/Quote]
对的
SQL77 2009-08-09
  • 打赏
  • 举报
回复
这个应该与数据库表进行联系,然后查询匹配的记录行数,时间就计算一下就好了,数据库中也可以查询
STRING SQL="SELECT COUNT(*) FROM TB WHERE COL LIKE '%"+TEXTBOX.TEXT+"%'";
sjdev 2009-08-09
  • 打赏
  • 举报
回复
不知道。帮顶。
百度关键词排名查询工具 seo工具 seo 百味 程序员百味:www.bywei.cn/blog 整理收集 更多的seo工具包请登录我的博客或者联系Q:240349846 推荐seo工具: 1.一个功能超强的查找与替换工具 2.KeywordS关健字排名查询.rar 3.百度指数分析工具.rar 4.老虎Sitemap生成器0.6.1.zip 5.反链检查软件.rar 6.百万搜索引擎登陆器 7.oBlog日志群发机 .rar 8.简单设置关键字就能生成垃圾站的程序.rar 9.ASP搜索引擎蜘蛛爬行日志生成程序.rar 10.搜易网站登录器.rar 11.检查网站死链工具(xenu).rar 12.51snap(SEO快捕手).rar 13.维度统计.rar .......... 推荐seo教程: 1.Ethan对搜索引擎优化(SEO)的看法.pdf 2.seoshouce 3.SEO极品工具、SEO书籍教程 4.增加反向链接的101种方法 5.《Google Cash》快速致富手册.rar 6.《SEO教程2007版》王通搜索引擎排名(SEO)教程2009版.pdf 7.《SEO每日一贴笔记》完整版.pdf 8.《王通网站运营研究》电子书下载.exe 9.5天提高搜索引擎排名-Netfox编译.exe 10.AdSense 优化宝典.pdf 11.搜索引擎原理完整教程.pdf 12.搜索引擎优化魔法书.pdf 13.增加反向链接的101个方法.pdf 14.制定详尽的SEO计划.rar 15.中国500大优秀网站.doc 16.中文搜索引擎技术-解密分词技术.rar ....... 如果有什么疑问请登录博客留言,程序员百味非常高兴能认识一位做seo的朋友!希望我们能一起努力! come on! believe yourself! 程序员百味博客:www.bywei.cn/blog

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧