首页 新闻 赞助 找找看

關於數據採集的問題

0
悬赏园豆:5 [已关闭问题]

大家對數據採集有什麽心得?

我現在要採集這個網站,

http://www.thomasglobal.com/search/21010309555-Acrylic_Adhesives/directory/540130237-Hernon_Manufacturing_Inc./

通過IE打開是正常的,源碼也可以看到。但是就是用程序採集就得不到其中某部份的數據了。

我核心程序是:

 

public static string GetOpenReadHTML(string url)
        {
            try
            {               
                string strValue = "";
                using (WebClient wt = new WebClient())
                {
                    using (Stream stream = wt.OpenRead(url))
                    {
                        Encoding encoding = Encoding.GetEncoding("utf-8");
                        using (StreamReader streader = new StreamReader(stream, encoding))
                        {
                            strValue = streader.ReadToEnd();
                            strValue = strValue.Replace("\r", "");
                            strValue = strValue.Replace("\t", "");
                            strValue = strValue.Replace("\n", "");
                            Thread.Sleep(200);
                        }
                    }
                }
                return strValue;
            }
            catch
            {
                return "";
            }
        }

public static string GetOpenReadHTML(string url)    

    {      

      try        

    {                          

       string strValue = "";    

       using (WebClient wt = new WebClient())         

        {                  

        using (Stream stream = wt.OpenRead(url))    

                   {                  

              Encoding encoding = Encoding.GetEncoding("utf-8");                                   using (StreamReader streader = new StreamReader(stream, encoding))                    

              {                      

                      strValue = streader.ReadToEnd();
                                  strValue = strValue.Replace("\r", "");                                             strValue = strValue.Replace("\t", "");                                             strValue = strValue.Replace("\n", "");
                                  Thread.Sleep(200);             

                   }           

             }        

          }                

    return strValue;    

        }      

      catch     

       {             

   return "";      

      }      

 }

 

高手幫忙看下,擺脫~

help_hostwork的主页 help_hostwork | 初学一级 | 园豆:6
提问于:2009-12-11 16:57
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册