数据挖掘2016  

好多人在问:如何将百度地图里面搜索到的公司商家电话导出表格?怎样将把百度地图里面搜索到的公司 电话 地址 等数据导出excel里?

现在,很多人都在网络上找商家,联系业务。 百度地图里有很多的商家联系方式地址等数据,这便成为很多人的便捷方式。但是一个个地复制出来商家的电话,地址是一件很痛苦的事情, 于是想到开发一个程序,模拟人的操作,将所有的数据提取保存到EXCEL里。

交流学习QQ:3125547039

主要代码思路:

 m_objConnection.Open();             button1.Enabled = false;

            txtInfo.Text = "";             txtInfo.BackColor = Color.White;             ///////////////////////////////////////////////////////////////////////////             m_iCount = 0;             int itemCount = comboQItems.Count;             for (int i = 0; i < itemCount; i++)             {                 string str1 = comboQ.Items[i].ToString();                 Application.DoEvents();                 //////////////////////////////////////////////////////////////////////////////////////////////////////////                 //第一次 提取信息                 string strResult = clsDownLoad.GetHtml(strHttp);                 //string strResult = textBox3.Text ;

                POIinfoList = GetFirstALLinfo(strResult);                 if (POIinfoList == null)                 {                     MessageBox.Show(strQuxian + "没有获取任何数值--null,可能出现异常了");                 }                 else                 {                     foreach (POIParameter POIinfo in POIinfoList)                     {                         AddtoTable(POIinfo, 0);                     }                 }                 lblStatus.Text = "第0";

                //第2次到最后一次                 for (int iPage = 1; iPage < m_iPageCount; iPage++)                 {                     strResult = clsDownLoad.GetHtml(strHttp);

                    POIinfoList2 = GetALLinfo(strResult, iPage);                     if (POIinfoList2 == null)                     {                         Thread.Sleep(200);                         iPage = iPage - 1;                         continue;                     }                     else                     {                         foreach (POIParameter POIinfo in POIinfoList2)                         {                             AddtoTable(POIinfo, iPage);                             Application.DoEvents();                         }                     }                     lblStatus.Text = "第" + iPage.ToString();                     Application.DoEvents();

                }                 ///////////////////////////////////////////////////////////////////////////////////////////////             }             txtInfo.Text = txtInfo.Text + "  总共条数:" + m_iCount.ToString();             txtInfo.BackColor = Color.Green;

            m_objConnection.Close();             Thread.Sleep(1000);

            //保存到Excel里去             if (checkSaveToExcel.Checked)             {                 string strExcelFile = "";                 if (m_strOldAccess.Length < 7)                 {                     strExcelFile = Application.StartupPath + "\\Data\\Over\\Excel\\" + comboShenfen.Text + "\\" + txtCity.Text + txtAim.Text + m_iCount.ToString() + ".xls";                  }                 else                 {//WYF: insert into Old Access.                     int iPos1 = m_strOldAccess.LastIndexOf('_'); // BaiduPOI_昌都市景点94.mdb                     int iPos2 = m_strOldAccess.LastIndexOf('.'); // .mdb                     string strCityAimOldCount = m_strOldAccess.Substring(iPos1 + 1, iPos2 - iPos1 - 1);

                    strExcelFile = Application.StartupPath + "\\Data\\Over\\Excel\\" + comboShenfen.Text + "\\" + strCityAimOldCount + "_" + m_iCount.ToString() + ".xls";  //信阳灯具187.xls                 }

                EasyExcel.Access2Excel(strAccessFile, strExcelFile);             }

 

posted on 2016-09-11 08:56  data2016  阅读(6469)  评论(0编辑  收藏  举报