Foxtable(狐表)用户栏目专家坐堂 → 这种网页数据如何抓取数据


  共有13840人关注过本帖平板打印复制链接

主题:这种网页数据如何抓取数据

帅哥哟,离线,有人找我吗?
ZJZK2018
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:767 积分:6119 威望:0 精华:0 注册:2018/2/1 17:26:00
  发帖心情 Post By:2023/9/26 17:55:00 [只看该作者]

蓝老师我把代码发上来你帮我测试一下,先谢谢了

Dim web As New System.Windows.Forms.WebBrowser()
web.ScriptErrorsSuppressed = True '解决网页页面的脚本错误提示
web.Navigate("https://ggzy.zj.gov.cn/col/col1229682666/index.html?number=ggjyA02")

Do Until web.ReadyState = 4 AndAlso web.Document.GetElementById("7795744") IsNot Nothing
    Application.DoEvents '绘制控件的代码即刻生效
Loop
Dim elems As Object
elems = web.Document.GetElementById("7795744").GetElementsByTagName("div") '可以根据你指定的参数,找出

For Each elem As System.Windows.Forms.HtmlElement In elems
    
    If elem.getattribute("classname") = "fyxx_lsbox_r" Then
        'msgBox(elem.Children(0).getattribute("title"))        '这个有值
        'msgBox(elem.Children(1).getattribute("herf"))        '这个为空,没有数据
        msgBox(elem.innerHtml)

    End If
Next

[此贴子已经被作者于2023/9/27 9:53:12编辑过]

 回到顶部
总数 72 1 2 3 4 5 6 7 8 下一页