ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 3890|回复: 10

[求助] 请教大家这个多页网站数据如何抓取,谢谢!

[复制链接]

TA的精华主题

TA的得分主题

发表于 2017-9-22 18:35 | 显示全部楼层 |阅读模式
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-22 18:40 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
最后的数据如何分隔,谢谢!
[{"scode":"601390","sname":"中国中铁","hfqjg":17.10216355,"tdate":"2015-07-21T00:00:00","market":"SH","close":15.6,"zdf":10.014099999999999,"zdf3":14.285714257074874,"zdf5":11.747851018779413,"zdf10":21.118012371774331,"AGSZBHXS":266643156000.0,"rzye":7149757278.0,"rzyezb":2.68,"rzmre":3446043826.0,"rzmre3":4764729060.0,"rzmre5":5574969051.0,"rzmre10":9116197930.0,"rzche":771039479.0,"rzche3":1831481795.0,"rzche5":2800359569.0,"rzche10":6954413006.0,"rzjmre":2675004347.0,"rzjmre3":2933247265.0,"rzjmre5":2774609482.0,"rzjmre10":2161784924.0,"rqye":46267587.6,"rqyl":2965871.0,"rqmcl":4506781.0,"rqmcl3":11177976.0,"rqmcl5":15615104.0,"rqmcl10":17731446.0,"rqchl":4504281.0,"rqchl3":11251832.0,"rqchl5":15750804.0,"rqchl10":17653034.0,"rqjmcl":2500.0,"rqjmcl3":-73856.0,"rqjmcl5":-135700.0,"rqjmcl10":78412.0,"rzrqye":7196024865.6,"rzrqyecz":7103489690.4},{"scode":"601318","sname":"中国平安","hfqjg":93.71723176,"tdate":"2015-04-10T00:00:00","market":"SH","close":86.14,"zdf":5.7711,"zdf3":6.3063063071238421,"zdf5":10.407587789423781,"zdf10":10.238034299019603,"AGSZBHXS":466562859929.0,"rzye":40814900009.0,"rzyezb":8.75,"rzmre":6486948658.0,"rzmre3":17757012138.0,"rzmre5":26280877367.0,"rzmre10":44877600634.0,"rzche":4053473197.0,"rzche3":14150511289.0,"rzche5":21544597404.0,"rzche10":40011388274.0,"rzjmre":2433475461.0,"rzjmre3":3606500849.0,"rzjmre5":4736279963.0,"rzjmre10":4866212360.0,"rqye":199841268.26,"rqyl":2319959.0,"rqmcl":11387299.0,"rqmcl3":29838855.0,"rqmcl5":42515407.0,"rqmcl10":72228693.0,"rqchl":12387974.0,"rqchl3":29416589.0,"rqchl5":41930613.0,"rqchl10":71488334.0,"rqjmcl":-1000675.0,"rqjmcl3":422266.0,"rqjmcl5":584794.0,"rqjmcl10":740359.0,"rzrqye":41014741277.26,"rzrqyecz":40615058740.74},{"scode":"600030","sname":"中信证券","hfqjg":109.03613097,"tdate":"2014-12-16T00:00:00","market":"SH","close":29.77,"zdf":10.0148,"zdf3":20.4775394591627,"zdf5":12.170308964774206,"zdf10":58.35106382727664,"AGSZBHXS":292182478809.0,"rzye":22478761565.0,"rzyezb":7.69,"rzmre":8033384640.0,"rzmre3":17918333525.0,"rzmre5":30068245342.0,"rzmre10":57884546715.0,"rzche":5691007842.0,"rzche3":14384498070.0,"rzche5":24277092394.0,"rzche10":46472898517.0,"rzjmre":2342376798.0,"rzjmre3":3533835455.0,"rzjmre5":5791152948.0,"rzjmre10":11411648198.0,"rqye":147165851.56,"rqyl":4943428.0,"rqmcl":36234225.0,"rqmcl3":111987490.0,"rqmcl5":195859206.0,"rqmcl10":364901796.0,"rqchl":35480346.0,"rqchl3":110833877.0,"rqchl5":195227690.0,"rqchl10":363999241.0,"rqjmcl":753879.0,"rqjmcl3":1153613.0,"rqjmcl5":631516.0,"rqjmcl10":902555.0,"rzrqye":22625927416.56,"rzrqyecz":22331595713.44},{

TA的精华主题

TA的得分主题

发表于 2017-9-22 18:50 来自手机 | 显示全部楼层
lwx228 发表于 2017-9-22 18:40
最后的数据如何分隔,谢谢!
[{"scode":"601390","sname":"中国中铁","hfqjg":17.10216355,"tdate":"2015- ...

正则或者解析json

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-22 18:54 | 显示全部楼层
本帖最后由 lwx228 于 2017-9-22 19:02 编辑


惭愧,我也知道应该用正则,但无奈自己不会。
麻烦老师指导,谢谢!

Split来完成好象较复杂,谢谢!

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-22 19:01 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
好象还要将以下几个指标名要去除,麻烦老师指导,谢谢!
AGSZBHXS,close,hfqjg,market,rqchl,rqchl10,rqchl3,rqchl5,rqjmcl,rqjmcl10,rqjmcl3,rqjmcl5,rqmcl,rqmcl10,rqmcl3,rqmcl5,rqye,rqyl,rzche,rzche10,rzche3,rzche5,rzjmre,rzjmre10,rzjmre3,rzjmre5,rzmre,rzmre10,rzmre3,rzmre5,rzrqye,rzrqyecz,rzye,rzyezb,scode,sname,tdate,zdf,zdf10,zdf3,zdf5

TA的精华主题

TA的得分主题

发表于 2017-9-22 19:26 | 显示全部楼层
lwx228 发表于 2017-9-22 19:01
好象还要将以下几个指标名要去除,麻烦老师指导,谢谢!
AGSZBHXS,close,hfqjg,market,rqchl,rqchl10 ...

Sub 解析法()
    Dim D As Object, W As Object, strText$, URL$, arr()
    URL = "http://dcfm.eastmoney.com/em_mutisvcexpandinterface/api/js/get?type=RZRQ_DETAIL_NJ&token=70f12f2f4f091e459a279469fe49eca5&filter=(tdate='2017-09-21T00:00:00')&st=rzjmre&sr=-1&p=1&ps=10000&js=var%20VNiJJppm={pages:(tp),data:(x)}&type=RZRQ_DETAIL_NJ&time=1&rt=50202479"
    With CreateObject("msxml2.xmlhttp")
        .Open "GET", URL, False
        .send
        Do While .readyState <> 4
            DoEvents
        Loop
        strText = .responseText
    End With
    Set Dm = CreateObject("Htmlfile"): Set W = Dm.parentWindow
    W.execScript strText & ";a=VNiJJppm.data;o=a[0];b=[];for(k in o){b.push(k)};r=a.length;c=b.length"
    ReDim arr(1 To W.r, 1 To W.c)
    For i = 0 To W.r - 1
        For j = 0 To W.c - 1
            k = W.eval("b[" & j & "]")
            arr(i + 1, j + 1) = W.eval("a[" & i & "]." & k)
        Next
    Next
    Range("a2").Resize(UBound(arr), UBound(arr, 2)) = arr
End Sub

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2017-9-22 19:28 | 显示全部楼层
lwx228 发表于 2017-9-22 19:01
好象还要将以下几个指标名要去除,麻烦老师指导,谢谢!
AGSZBHXS,close,hfqjg,market,rqchl,rqchl10 ...

你把需要的指标 拿出来,不是把要去除的指标拿出来!!!
我已经把全部的指标都给 搞出来了!代码在审核中。。。。。。。。。。。。。请坐等!!!

评分

1

查看全部评分

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-9-22 19:54 | 显示全部楼层
duquancai 发表于 2017-9-22 19:28
你把需要的指标 拿出来,不是把要去除的指标拿出来!!!
我已经把全部的指标都给 搞出来了!代码在审核 ...

谢谢老师:
是我表达错了,应是这些指标的数据全要,只是这些指标的名称自身可以去除。谢谢!

TA的精华主题

TA的得分主题

发表于 2018-4-9 15:34 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
太厉害了~~~~~~~~~~~~~

TA的精华主题

TA的得分主题

发表于 2018-6-10 22:18 | 显示全部楼层
duquancai 发表于 2017-9-22 19:26
Sub 解析法()
    Dim D As Object, W As Object, strText$, URL$, arr()
    URL = "http://dcfm.east ...

能否备注一下?谢谢
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2025-1-14 20:14 , Processed in 0.030111 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表