'-----------------翟振恺(小琦) start=Newstring(wstr,start) '设置需要处理的数据的唯一的开始标记 over=Newstring(wstr,over) '和start相对应的就是需要处理的数据的唯一的结束标记 body=mid(wstr,start,over-start) '设置显示页面的范围 '-----------------翟振恺(小琦) End Function 调用方法:body(被采集的页面的内容,开始标记,结束标记) 2、用正则获取需要的数据
CODE:[Copy to clipboard]Function body(wstr,start,over) '-----------------翟振恺(小琦) Set xiaoqi = New Regexp'设置配置对象 xiaoqi.IgnoreCase = True'忽略大小写 xiaoqi.Global = True'设置为全文搜索 xiaoqi.Pattern = "”&start&“.+?”&over&“"'正则表达式 Set Matches =xiaoqi.Execute(wstr)'开始执行配置 set xiaoqi=nothing body="" For Each Match in Matches body=body&Match.Value '循环匹配 Next '-----------------翟振恺(小琦) End Function 调用方法:body(被采集的页面的内容,开始标记,结束标记) 采集程序祥细思路: 1、取得网站的分页列表页的每页地址 目前绝大部分动态网站的分页地址都有规则,如: 动态页 第一页:index.asp?page=1 第二页:index.asp?page=2 第三页:index.asp?page=3 .....
CODE:[Copy to clipboard]'-----------------翟振恺(小琦) Set xiaoqi = New Regexp xiaoqi.IgnoreCase = True xiaoqi.Global = True xiaoqi.Pattern = ””“.+?”““ Set Matches =xiaoqi.Execute(页面列表内容) set xiaoqi=nothing url="" For Each Match in Matches url=url&Match.Value Next '-----------------翟振恺(小琦) 4、取得被采集的内容页面内容,根据”提取标记“从被采集的内容页面分别截取要取得的数据