<% '转发时请保留此声明信息,这段声明不并会影响你的速度!'************************** 【先锋海盗类】Ver2005 最终版********************************'作者:孙立宇、apollosun、ezhonghua'改进者:arllic '【消除所有的BUG,去掉了一些不易使用,容易使人误解的功能,优化了执行效率,此为最终版】'官方网站:http://www.lkstar.com 技术支持论坛:http://bbs.lkstar.com'电子邮件:kickball@netease.com 在线QQ:94294089'版权声明:版权没有,盗版不究,源码公开,各种用途均可免费使用,欢迎你到技术论坛来寻求支持。'——小偷程序的原理是通过XHTML和ASP技术相结合,定向集中采集远程网页内容加工后转为本地虚拟网页。'——此技术自诞生以来由于它的信息覆盖面、广同步更新和免维护的特性一直受到各编程爱好者的关注和追捧。'——目前国内比较流行的实时新闻、闪客动漫、流行歌曲、软件下载、天气预报、股票查询等优秀作品。'——然而由于制作小偷程序的过程过于复杂和繁琐,还由于远程网页代码的变更而经常失效,这使小偷网页的'维护成为一个噩梦!所以到目前为止,目前此类佳作不多,技术也集中在小部分人手中。'——先锋海盗类的诞生将使小偷程序的制作和维护变得容易起来。先锋海盗类提供的12种类方法将使你对采集'内容的编辑掌控能力变得空前强大,另有贴心的类排错debug方法可以使你随时观察自己在各步骤获得的代码和'页面显示效果,彻底掌握这些类方法将使你为所欲为地采集编辑各种远程页面,而且维护也相当方便!'——总而言之,使用先锋海盗类将使你的"小偷"程序晋升为"海盗"程序!'详细使用说明或范例请见下载附件或到本人官方站点下载!'-------------------------------------------------------------------------------------Class clsThief'____________________Private value_ '窃取到的内容Private src_ '要偷的目标URL地址Private isGet_ '判断是否已经偷过
public property let src(str) '赋值—要偷的目标URL地址/属性src_=strend property
public property get value '返回值—最终窃取并应用类方法加工过的内容/属性value=value_end property
Public Property get Version Version="先锋海盗类 Version 2005"End Property
private sub class_initialize()value_=""src_=""isGet_= falseend subprivate sub class_terminate()end sub
private Function BytesToBstr(body,Cset) '中文处理dim objstreamset objstream = Server.CreateObject("adodb.stream")objstream.Type = 1objstream.Mode =3objstream.Openobjstream.Write bodyobjstream.Position = 0objstream.Type = 2objstream.Charset = CsetBytesToBstr = objstream.ReadText objstream.Closeset objstream = nothingEnd Function
public sub steal() '窃取目标URL地址的HTML代码/方法if src_<>"" then dim Http set Http=server.createobject("MSXML2.XMLHTTP") Http.open "GET",src_ ,false Http.send() if Http.readystate<>4 then exit sub end if value_=BytesToBSTR(Http.responseBody,"GB2312") isGet_= True set http=nothing if err.number<>0 then err.Clearelse response.Write("<script>alert(""请先设置src属性!"")</script>")end ifend sub
'删除偷到的内容中里面的换行、回车符以便进一步加工/方法public sub noReturn() if isGet_= false then call steal()value_=replace(replace(value_ , vbCr,""),vbLf,"")end sub
'对偷到的内容中的个别字符串用新值更换/方法public sub change(oldStr,str) '参数分别是旧字符串,新字符串if isGet_= false then call steal()value_=replace(value_ , oldStr,str)end sub
'按指定首尾字符串对偷取的内容进行裁减(不包括首尾字符串)/方法public sub cut(head,bot) '参数分别是首字符串,尾字符串if isGet_= false then call steal() if instr(value_ , head)>0 and instr(value_ , bot)>0 then value_=mid(value_ ,instr(value_ ,head)+len(head),instr(value_ ,bot)-instr(value_ ,head)-len(head)) else value_= "<p align=""center"">函数cut指定裁减内容不存在,请重新定义" end ifend sub
'按指定首尾字符串对偷取的内容进行裁减(包括首尾字符串)/方法public sub cutX(head,bot) '参数分别是首字符串,尾字符串if isGet_= false then call steal() if instr(value_,head)>0 and instr(value_,bot)>0 then value_=mid(value_ ,instr(value_ ,head),instr(value_ ,bot)-instr(value_ ,head)+len(bot)) else value_= "<p align=""center"">函数cutX指定裁减的内容不存在" end ifend sub
'按指定首尾字符串位置偏移指针对偷取的内容进行裁减/方法public sub cutBy(head,headCusor,bot,botCusor) '参数分别是首字符串,首偏移值,尾字符串,尾偏移值,左偏移用负值,偏移指针单位为字符数if isGet_= false then call steal() if instr(value_,head)>0 and instr(value_,bot)>0 then value_=mid(value_ ,instr(value_ ,head)+len(head)+headCusor,instr(value_ ,bot)-1+botCusor-instr(value_ ,head)-len(head)-headcusor) else value_= "<p align=""center"">函数cutBy指定裁减内容不存在" end ifend sub
'按指定首尾字符串对偷取的内容用新值进行替换(不包括首尾字符串)/方法public sub filt(head,bot,str) '参数分别是首字符串,尾字符串,新值,新值位空则为过滤if isGet_= false then call steal() if instr(value_,head)>0 and instr(value_,bot)>0 then value_=replace(value_,mid(value_ ,instr(value_ ,head)+len(head) , instr(value_ ,bot)-instr(value_ ,head)-len(head)),str) else value_= "<p align=""center"">函数filt指定替换的内容不存在" end ifend sub
'按指定首尾字符串对偷取的内容用新值进行替换(包括首尾字符串)/方法public sub filtX(head,bot,str) '参数分别是首字符串,尾字符串,新值,新值为空则为过滤if isGet_= false then call steal() if instr(value_,head)>0 and instr(value_,bot)>0 then value_=replace(value_,mid(value_ ,instr(value_ ,head),instr(value_ ,bot)-instr(value_ ,head)+len(bot)),str) else value_= "<p align=""center"">函数filtX指定替换的内容不存在" end ifend sub
'按指定首尾字符串位置偏移指针对偷取的内容新值进行替换/方法public sub filtBy(head,headCusor,bot,botCusor,str) '参数分别是首字符串,首偏移值,尾字符串,尾偏移值,新值,左偏移用负值,偏移指针单位为字符数,新值为空则为过滤if isGet_= false then call steal() if instr(value_,head)>0 and instr(value_,bot)>0 then value_=replace(value_ ,mid(value_ ,instr(value_ ,head)+len(head)+headCusor,instr(value_ ,bot)-1+botCusor-instr(value_ ,head)-len(head)-headcusor),str) else value_= "<p align=""center"">函数filtBy指定替换的内容不存在" end ifend sub
'对符合条件的内容进行分块采集并组合,最终内容为以<!--lkstar-->隔断的大文本/方法'通过属性value得到此内容后你可以用split(value,"<!--lkstar-->")得到你需要的数组public sub rebuild(str) '参数是你目标页面反复出现的特征字符if isGet_= false then call steal()value_= replace(value_,str,vbcrlf&"<!--lkstar-->"&vbcrlf)end sub
'类排错模式——在类释放之前应用此方法可以随时查看你截获的内容HTML代码和页面显示效果/方法public sub debug()dim tempstrtempstr="<SCRIPT>function runEx(){var winEx2 = window.open("""", ""winEx2"", ""width=500,height=300,status=yes,menubar=no,scrollbars=yes,resizable=yes""); winEx2.document.open(""text/html"", ""replace""); winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value)); winEx2.document.close(); }function saveFile(){var win=window.open('','','top=10000,left=10000');win.document.write(document.all.asdf.innerText);win.document.execCommand('SaveAs','','javascript.htm');win.close();}</SCRIPT><center><TEXTAREA id=asdf name=textfield rows=32 wrap=VIRTUAL cols=""120"">"&value_&"</TEXTAREA><BR><BR><INPUT name=Button onclick=runEx() type=button value=""查看效果""> <INPUT name=Button onclick=asdf.select() type=button value=""全选""> <INPUT name=Button onclick=""asdf.value=''"" type=button value=""清空""> <INPUT onclick=saveFile(); type=button value=""保存代码""></center>"response.Write(tempstr)end subend class%>
推荐阅读
asp存储过程使用大全
1,调用没有参数的存储过程 <% set conn=server.CreateObject("adodb.connection") set cmd=server.CreateObject("adodb.command") strconn="dsn=pubs;uid=sa;pwd" conn.Open strconn set cmd.ActiveConnection=co>>>详细阅读
本文标题:先锋海盗类
地址:http://www.17bianji.com/kaifa2/ASP/33254.html
1/2 1