以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]抓取网页数据仅能运行15页 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80467) |
||||||||
-- 作者:dqlgood -- 发布时间:2016/1/23 17:12:00 -- [求助]抓取网页数据仅能运行15页 如题:见附件
通过,浏览器查看源代码,修改后得到: Dim p() As String = "第九列,大单_流入,大单_流出,第九列,中单_流入,中单_流出,第九列,小单_流入,小单_流出".split(",") For Each rw As Row In Tables("表A").Rows Dim web As new System.Windows.Forms.WebBrowser web.Navigate("http://stockpage.10jqka.com.cn/" & rw("证券代码") & "/") Do Until web.ReadyState = 4 Application.DoEvents Loop For Each div As object In web.Document.GetElementsByTagName("div") If div.GetAttribute("ClassName") = "sub_cont_5 m_s_l hSty1" Dim n As Integer = 0 Dim dr As Row = Tables("表B").AddNew() dr("证券代码") = rw("证券代码") For Each td As object In div.GetElementsByTagName("td") dr(p(n)) = td.InnerText n=n+1 Next End If Next Next 测试通过,但只能运行15行数据,到16行即即使为重复数据也停顿如何解决?
[此贴子已经被作者于2016/1/24 8:40:37编辑过]
|
||||||||
-- 作者:大红袍 -- 发布时间:2016/1/24 11:01:00 -- Dim p() As String = "第九列,大单_流入,大单_流出,第九列,中单_流入,中单_流出,第九列,小单_流入,小单_流出".split(",") Dim web As new System.Windows.Forms.WebBrowser For Each rw As Row In Tables("表A").Rows web.Navigate("http://stockpage.10jqka.com.cn/" & rw("证券代码") & "/") Do Until web.ReadyState = 4 Application.DoEvents Loop For Each div As object In web.Document.GetElementsByTagName("div") If div.GetAttribute("ClassName") = "sub_cont_5 m_s_l hSty1" Dim n As Integer = 0 Dim dr As Row = Tables("表B").AddNew() dr("证券代码") = rw("证券代码") For Each td As object In div.GetElementsByTagName("td") dr(p(n)) = td.InnerText n=n+1 Next End If Next Next |
||||||||
-- 作者:dqlgood -- 发布时间:2016/1/24 11:44:00 -- 谢谢! |