如题,C#的。比如google.com.hk 搜索中国 获得约 1,030,000,000 条结果提取出来1,030,000,000

解决方案 »

  1.   

    很容易提取,楼主还是自己写吧~我是用HttpWebRequest取得html再用正则提取~~
      

  2.   

    1、思路分析,你用firefox访问页面后,用firedug就可以看到,这个搜素结果的记录个数存储在:
    div=resultStats中:2、实现方法:
    可以用webbrowser控件发起访问,然后,获取!//先拖动一个Webrowser控件到窗体上!
            //窗体加载时,访问google搜素页面
            private void Form1_Load(object sender, EventArgs e)
            {
                this.webBrowser1.Navigate("http://www.google.com.hk");
            }
            //点击按钮后搜素“中学”
            private void button1_Click(object sender, EventArgs e)
            {
                HtmlElement btnSearch = webBrowser1.Document.GetElementById("btnG");
                HtmlElement txtContact = webBrowser1.Document.GetElementById("q");
                if (txtContact == null || btnSearch == null)
                {
                    return;
                }
                txtContact.SetAttribute("value", "中学");
                btnSearch.InvokeMember("click");            this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
            }        void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                HtmlElement he = this.webBrowser1.Document.GetElementById("resultStats");
                MessageBox.Show(he.InnerText);
            }
    运行效果图:
      

  3.   

    httpwebrequest通过post实现搜索,获取返回的页面数据
    通过正则获取总数
    string param = "";  
    byte[] bs = Encoding.ASCII.GetBytes(param);   
    HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(""); 
    req.Method = "POST";   
    req.ContentType = "application/x-www-form-urlencoded";  
    req.ContentLength = bs.Length;   
    using (Stream reqStream = req.GetRequestStream())