当前位置:编程学习 > VB >>

求助了很多会vb的朋友都没有得到答案,只有找csdn了

http://nowgoal.com/nba.htm?date=2012-12-17 

像静态页面的数据截取很简单啦,但是上面这种动态的,好像是js的,小弟问了很多高手都弄不出来,只有求助百度知道,有没有高手能提供个思路?

--------------------编程问答-------------------- 另外小弟不是新人,之前一直在csdn混,但是从用户名不能登录开始就。。。 --------------------编程问答-------------------- 那就VB也设一个定时器,定时读json数据或者网页上的table数据就好了。
js我看了,就setTimeout设的定时而已。 --------------------编程问答-------------------- 我看了页面,全是数据。获取网页数据,应该不难吧。
你看它什么时候更新一次,在你的程序中动态更新。 --------------------编程问答-------------------- 谢谢各位回复,我用的是
Private Function getHtmlStr$(strUrl$) '获取源码
Dim XmlHttp
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "GET", strUrl, True
XmlHttp.send
stime = Now '获取当前时间
While XmlHttp.ReadyState <> 4
DoEvents
ntime = Now '获取循环时间
If DateDiff("s", stime, ntime) > 30 Then getHtmlStr = "": Exit Function '
Wend
getHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
Set XmlHttp = Nothing
End Function

然后用getcode = getHtmlStr$(pickscode)
可以下载截取回来的源码里面,并没有页面显示的数据。而是js代码,我想请教各位的是,如何能拿到页面上显示的数据呢?谢谢 --------------------编程问答-------------------- 请教大家?好像没有人回答了。 --------------------编程问答-------------------- 抓下包,你需要的数据估计都能找到。
找不到再来问吧。 --------------------编程问答-------------------- 两个方法,一个是看懂js,模拟js的代码再提交对象的数据获取,另一个是使用webbrowser。 --------------------编程问答-------------------- 嗯,用webbrowser,另外如果js不太易做图的话,似乎到mshtml一层就可以了 --------------------编程问答-------------------- 看了一下,下面是页面中用ajax取数据的关键函数:
function getxml()
{
oXmlHttp.open("get","nba/change_en.xml?" + Date.parse(new Date()),true);
oXmlHttp.onreadystatechange = refresh;
oXmlHttp.send(null);
window.setTimeout("getxml()",3000);


取得的是xml格式数据。下面是我得到的一个数据包:
<?xml  version="1.0" encoding="utf-8"?><c><o>139162,0.87,-2.5,0.87,0.87,123.5,0.87,,</o><o>147465,0.87,-5,0.87,0.87,172.5,0.87,,</o><o>134124,0.87,6.5,0.87,0.87,155.5,0.87,1.33,3.00</o><o>140028,0.87,9.5,0.87,0.87,148.5,0.87,1.17,4.60</o><o>147349,0.87,33.5,0.87,0.87,160.5,0.87,1.00,16.00</o><o>133047,0.87,6,0.87,0.87,155.5,0.87,1.33,3.00</o><o>133048,0.87,-2,0.87,0.87,159.5,0.87,1.85,1.85</o><o>133051,0.87,6.5,0.87,0.87,158.5,0.87,1.33,3.00</o><o>133052,0.87,10.5,0.87,0.87,153,0.87,1.10,6.00</o><o>133242,0.87,6.5,0.87,0.87,150.5,0.87,1.25,3.60</o><o>133053,0.87,-7.5,0.87,0.87,142.5,0.87,3.25,1.30</o><o>133054,0.87,-9.5,0.87,0.87,157.5,0.87,4.00,1.22</o><o>140473,0.87,-14.5,0.87,0.87,151.5,0.87,7.50,1.06</o><o>145560,0.87,1.5,0.87,0.87,138.5,0.87,,</o><o>147466,0.87,5.5,0.87,0.87,154.5,0.87,,</o><o>147467,0.87,2,0.87,0.87,160.5,0.87,,</o><o>147468,0.87,-6.5,0.87,0.87,151.5,0.87,,</o><o>140077,0.87,16.5,0.87,0.87,149.5,0.87,1.03,10.00</o><o>145562,0.87,18.5,0.87,0.87,132.5,0.87,,</o><o>147472,0.87,1.5,0.87,0.87,177.5,0.87,1.75,1.95</o><o>140475,0.87,-6.5,0.87,0.87,148.5,0.87,3.25,1.30</o><o>145561,0.87,9.5,0.87,0.87,143.5,0.87,,</o><o>147355,0.87,-2,0.87,0.87,144.5,0.87,2.00,1.73</o><o>139488,0.87,4.5,0.87,0.87,154.5,0.87,,</o><o>140076,0.87,15.5,0.87,0.87,157.5,0.87,1.05,8.00</o><o>140470,0.87,13.5,0.87,0.87,149.5,0.87,1.08,6.50</o><o>141955,0.87,6.5,0.87,0.87,152.5,0.87,1.25,3.60</o><o>147350,0.87,1.5,0.87,0.87,144.5,0.87,1.85,1.85</o><o>147469,0.87,-8.5,0.87,0.87,171.5,0.87,4.25,1.20</o><o>141956,0.87,-1.5,0.87,0.87,151.5,0.87,1.91,1.80</o><o>139487,0.87,5.5,0.87,0.87,144.5,0.87,,</o><o>139485,0.87,22.5,0.87,0.87,157.5,0.87,,</o><o>139645,0.87,1.5,0.87,0.87,142,0.87,,</o><o>139647,0.87,6,0.87,0.87,152.5,0.87,,</o><o>139648,0.87,6.5,0.87,0.87,146.5,0.87,,</o><o>141957,0.87,4,0.87,0.87,152.5,0.87,1.53,2.37</o><o>145564,0.87,16.5,0.87,0.87,140.5,0.87,,</o><o>147304,0.87,18.5,0.87,0.87,152.5,0.87,,</o><o>147314,0.87,-11.5,0.87,0.87,167.5,0.87,6.50,1.08</o><o>147351,0.87,-18.5,0.87,0.87,146,0.87,12.00,1.01</o><o>147470,0.87,9.5,0.87,0.87,159,0.87,1.20,4.25</o><o>147471,0.87,9.5,0.87,0.87,156.5,0.87,1.17,4.60</o><o>133321,0.87,2.5,0.87,0.87,151,0.87,,</o><o>137589,0.87,1.5,0.87,0.87,163.5,0.87,1.75,1.95</o><o>138508,0.87,-4.5,0.87,0.87,160.5,0.87,2.37,1.53</o><o>139486,0.87,-9.5,0.87,0.87,159.5,0.87,,</o><o>140029,0.87,-2,0.87,0.87,149.5,0.87,1.91,1.80</o><o>141958,0.87,5.5,0.87,0.87,142.5,0.87,1.40,2.75</o><o>141959,0.87,7,0.87,0.87,154.5,0.87,1.30,3.25</o><o>141960,0.87,4.5,0.87,0.87,150.5,0.87,1.50,2.50</o><o>143890,0.87,-9,0.87,0.87,146.5,0.87,4.50,1.18</o><o>145315,0.87,10,0.87,0.87,147.5,0.87,,</o><o>140030,0.87,-7,0.87,0.87,146.5,0.87,2.87,1.36</o><o>137590,0.87,26.5,0.87,0.87,156.5,0.87,1.00,16.00</o><o>138689,0.87,-6.5,0.87,0.87,168,0.87,2.62,1.44</o><o>139649,0.87,6.5,0.87,0.87,152,0.87,,</o><o>146688,0.87,-5.5,0.87,0.87,158.5,0.87,3.00,1.33</o><o>146689,0.87,-9.5,0.87,0.87,143.5,0.87,4.60,1.17</o><o>147129,0.87,-1.5,0.87,0.87,145.5,0.87,,</o><o>147352,0.87,-2.5,0.87,0.87,148.5,0.87,2.20,1.60</o><o>147493,0.87,7,0.87,,,,1.36,3.40</o><o>138860,0.87,3.5,0.87,0.87,147.5,0.87,1.53,2.37</o><o>138861,0.87,4,0.87,0.87,158.5,0.87,1.57,2.25</o><o>138863,0.87,4.5,0.87,0.87,149.5,0.87,1.50,2.50</o><o>139008,0.87,1.5,0.87,0.87,164.5,0.87,1.67,2.10</o><o>139010,0.87,4.5,0.87,0.87,142.5,0.87,1.50,2.50</o><o>137591,0.87,1,0.87,0.87,159.5,0.87,1.80,1.91</o><o>135412,0.87,-3.5,0.87,0.87,200.5,0.87,2.55,1.57</o><o>147497,0.87,7,0.87,,,,1.33,3.50</o><o>147501,0.87,4,0.87,,,,1.57,2.55</o><o>147506,0.87,13.5,0.87,,,,,</o><o>147503,0.87,9,0.87,,,,,</o><o>147507,0.87,4,0.87,,,,1.57,2.55</o><o>147508,0.87,7.5,0.87,0.87,139.5,0.87,1.31,3.60</o><o>142280,0.87,20.5,0.87,0.87,181.5,0.87,,</o><o>147513,0.87,17,0.87,,,,1.02,15.00</o><o>133903,0.87,6,0.87,0.87,156.5,0.87,1.75,1.95</o><o>135413,0.87,-4.5,0.87,0.87,204.5,0.87,2.65,1.53</o><o>135414,0.87,-3.5,0.87,0.87,196.5,0.87,2.45,1.61</o><o>147490,0.87,7,0.87,0.87,167,0.87,,</o><o>147517,0.87,14,0.87,0.87,133.5,0.87,1.07,9.00</o><o>133913,0.87,10.5,0.87,0.87,162.5,0.87,,</o><o>133910,0.87,12.5,0.87,0.87,155.5,0.87,,</o><o>133911,0.87,3.5,0.87,0.87,155.5,0.87,,</o><o>133914,0.87,-3,0.87,0.87,154.5,0.87,,</o><o>147491,0.87,7.5,0.87,0.87,160.5,0.87,,</o><o>133912,0.87,4,0.87,0.87,154,0.87,,</o><o>147492,0.87,4.5,0.87,0.87,147.5,0.87,,</o><o>147519,0.87,9.5,0.87,,,,1.18,4.75</o><o>135415,0.87,5,0.87,0.87,185.5,0.87,1.48,2.75</o><o>139163,0.87,3.5,0.87,0.87,127,0.87,,</o><o>140032,0.87,-6,0.87,0.87,149.5,0.87,,</o><o>140031,0.87,8.5,0.87,0.87,137.5,0.87,1.20,4.25</o><o>140075,0.87,-8.5,0.87,0.87,150.5,0.87,3.60,1.25</o><o>140468,0.87,13.5,0.87,0.87,152.5,0.87,1.08,6.50</o><o>140078,0.87,-2.5,0.87,0.87,158.5,0.87,1.80,1.91</o><o>143891,0.87,10,0.87,0.87,147.5,0.87,1.17,4.60</o><o>147520,0.87,9.5,0.87,0.87,156.5,0.87,1.17,4.50</o><o>147551,0.87,-6.5,0.87,0.87,154.5,0.87,,</o><o>138506,0.87,-1.5,0.87,0.87,141,0.87,1.85,1.85</o><o>143452,0.87,5.5,0.87,0.87,174.5,0.87,1.40,2.75</o><o>137491,0.87,4.5,0.87,0.87,175,0.87,1.50,2.50</o><o>143892,0.87,4,0.87,0.87,142.5,0.87,1.57,2.25</o><o>147552,0.87,-9.5,0.87,0.87,168,0.87,,</o><o>147553,0.87,20,0.87,0.87,160.5,0.87,,</o><o>135416,0.87,-3.5,0.87,0.87,192.5,0.87,2.50,1.59</o><o>147529,0.87,-3.5,0.87,,,,2.50,1.59</o><o>147530,0.87,25,0.87,,,,,</o><o>147532,0.87,18.5,0.87,0.87,152,0.87,1.03,11.00</o><o>147533,0.87,22,0.87,0.87,131.5,0.87,,</o><o>147550,0.87,15,0.87,0.87,143,0.87,1.08,8.00</o><o>135417,0.87,-6.5,0.87,0.87,192,0.87,3.50,1.33</o><o>135418,0.87,7.5,0.87,0.87,210,0.87,1.28,3.75</o><o>135419,0.87,5.5,0.87,0.87,208.5,0.87,1.45,2.80</o><o>135420,0.87,6.5,0.87,0.87,179,0.87,1.40,3.10</o><o>147534,0.87,-6.5,0.87,0.87,132.5,0.87,3.50,1.33</o><o>147537,0.87,-4,0.87,,,,2.50,1.59</o><o>147538,0.87,12,0.87,,,,1.14,6.00</o><o>147541,0.87,5.5,0.87,,,,1.37,3.30</o><o>135421,0.87,7,0.87,0.87,197,0.87,1.36,3.40</o><o>147542,0.87,10.5,0.87,0.87,127,0.87,1.14,6.00</o><o>147545,0.87,2.5,0.87,,,,1.77,2.10</o><o>147546,0.87,11.5,0.87,,,,1.12,6.50</o><o>147548,0.87,5.5,0.87,,,,1.40,3.10</o></c> --------------------编程问答-------------------- 看来用 webbrowser的方法我能做到,先尝试下看看 --------------------编程问答--------------------
using mshtml;
--------------------编程问答-------------------- webbroweser 也好,所有的都只能拿到js源码,不能获取页面数据,只有vbtoy的ajax也许能拿到。 --------------------编程问答-------------------- 这种东西直接看js部分找到关键的url就可以很容易取得数据的,用webbroweser效率太低,而且代码兼容性也差,我个人建议最好不要这么搞。 --------------------编程问答-------------------- 最近我也在研究vb获取网络数据的代码,关注中!!
--------------------编程问答-------------------- 看一下这个是不是你想要的 http://nowgoal.com/ajax.aspx?type=11&date=2012/12/17&1358849625000 --------------------编程问答-------------------- 除
补充:VB ,  网络编程
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,