回 帖 发 新 帖 刷新版面

主题:xmlhttp写小偷程序问题,IP不对??求解

有ASP高手不?请教一个问题,
小偷程序的编写,用他来偷取天气预报,YAHOO。COM的
我写好了,可以发现是根据服务器断的IP来偷取的,请问有没有有根据客户断来偷取的啊办法啊用的是XMLHTTP
可能是自己技术不怎么好,我用抓取yahoo首页的html在,取出他那里的显示天气的代码,可是我发现他的网页天天有变化,我抓取的东西会不正确,抓了一些没用的东西,
另外一个问题就是,发现,是根据服务器断的IP来显示天气,也就是说抓取代码是从服务器断抓的,也就是显示了服务器那个地方的天气预报
哎!!!郁闷
请问有没有好的方法,能正确的抓到天气预报,

回复列表 (共14个回复)

11 楼

'获取温度、气像
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "[^\d]+([+|-]?\d+)℃[^<]+<img alt=""([\u4e00-\u9fa5]+)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=4
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                i=i+1
                f(i)=trim(Match.SubMatches(1))
                Next
                set regEx = nothing
'获取温度、气像
'获取风力
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "<td  class=""blog_xhui"">[^\u4e00-\u9fa5]*[\u4e00-\u9fa5]+[^\d]?(\d*)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=6
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                Next
                set regEx = nothing
'获取风力
'获取能见度                
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = """ class=""blog_xhui"">[^\d]+(\d+)公里"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=7
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                Next
                set regEx = nothing
'获取能见度                
'获取天气实况

12 楼

'获取温度、气像
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "[^\d]+([+|-]?\d+)℃[^<]+<img alt=""([\u4e00-\u9fa5]+)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=4
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                i=i+1
                f(i)=trim(Match.SubMatches(1))
                Next
                set regEx = nothing
'获取温度、气像
'获取风力
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "<td  class=""blog_xhui"">[^\u4e00-\u9fa5]*[\u4e00-\u9fa5]+[^\d]?(\d*)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=6
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                Next
                set regEx = nothing
'获取风力
'获取能见度                
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = """ class=""blog_xhui"">[^\d]+(\d+)公里"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=7
                For Each Match in Matches       ' 循环遍历Matches集合。
                f(i)=trim(Match.SubMatches(0))
                Next
                set regEx = nothing
'获取能见度                
'获取天气实况

13 楼

'获取城市
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "{([\u4e00-\u9fa5]+)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                For Each Match in Matches       ' 循环遍历Matches集合。
                g(0)=Match.SubMatches(0)
                Next
                set regEx = nothing     
'获取城市
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "<td class=""font_sl"">[东经|北纬|海拔]{2}:([\d\.\d]+)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=1
                For Each Match in Matches       ' 循环遍历Matches集合。
                g(i)=Match.SubMatches(0)
                i=i+1 
                Next
                set regEx = nothing     
                Set regEx = New RegExp            ' 建立正则表达式。
                regEx.Pattern = "e class=""font_sl"">([^\<]+)"            ' 设置模式。
                regEx.IgnoreCase = True        ' 设置区分大小写。
                regEx.Global = True            ' 搜索全部匹配。
                Set Matches = regEx.Execute(html)    ' 执行搜索。
                i=4
                For Each Match in Matches       ' 循环遍历Matches集合。
                g(i)=Match.SubMatches(0)
                i=i+1 
                Next
                set regEx = nothing    

14 楼

谢谢

我来回复

您尚未登录,请登录后再回复。点此登录或注册