zl程序教程

您现在的位置是:首页 >  其它

当前栏目

先锋海盗类

先锋 海盗
2023-06-13 09:13:41 时间

<%
"转发时请保留此声明信息,这段声明不并会影响你的速度!
"**************************  【先锋海盗类】Ver2005 最终版********************************
"作者:孙立宇、apollosun、ezhonghua
"改进者:arllic
"【消除所有的BUG,去掉了一些不易使用,容易使人误解的功能,优化了执行效率,此为最终版】
"官方网站:http://www.lkstar.com  技术支持论坛:http://bbs.lkstar.com
"电子邮件:kickball@netease.com   在线QQ:94294089
"版权声明:版权没有,盗版不究,源码公开,各种用途均可免费使用,欢迎你到技术论坛来寻求支持。
"――小偷程序的原理是通过XHTML和ASP技术相结合,定向集中采集远程网页内容加工后转为本地虚拟网页。
"――此技术自诞生以来由于它的信息覆盖面、广同步更新和免维护的特性一直受到各编程爱好者的关注和追捧。
"――目前国内比较流行的实时新闻、闪客动漫、流行歌曲、软件下载、天气预报、股票查询等优秀作品。
"――然而由于制作小偷程序的过程过于复杂和繁琐,还由于远程网页代码的变更而经常失效,这使小偷网页的
"维护成为一个噩梦!所以到目前为止,目前此类佳作不多,技术也集中在小部分人手中。
"――先锋海盗类的诞生将使小偷程序的制作和维护变得容易起来。先锋海盗类提供的12种类方法将使你对采集
"内容的编辑掌控能力变得空前强大,另有贴心的类排错debug方法可以使你随时观察自己在各步骤获得的代码和
"页面显示效果,彻底掌握这些类方法将使你为所欲为地采集编辑各种远程页面,而且维护也相当方便!
"――总而言之,使用先锋海盗类将使你的"小偷"程序晋升为"海盗"程序!
"详细使用说明或范例请见下载附件或到本人官方站点下载!
"-------------------------------------------------------------------------------------
ClassclsThief
"____________________
Privatevalue_   "窃取到的内容
Privatesrc_     "要偷的目标URL地址
PrivateisGet_   "判断是否已经偷过

publicpropertyletsrc(str)"赋值―要偷的目标URL地址/属性
src_=str
endproperty

publicpropertygetvalue"返回值―最终窃取并应用类方法加工过的内容/属性
value=value_
endproperty

PublicPropertygetVersion
 Version="先锋海盗类Version2005"
EndProperty

privatesubclass_initialize()
value_=""
src_=""
isGet_=false
endsub

privatesubclass_terminate()
endsub

privateFunctionBytesToBstr(body,Cset)"中文处理
dimobjstream
setobjstream=Server.CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction

publicsubsteal()"窃取目标URL地址的HTML代码/方法
ifsrc_<>""then
 dimHttp
 setHttp=server.createobject("MSXML2.XMLHTTP")
 Http.open"GET",src_,false
 Http.send()
 ifHttp.readystate<>4then
  exitsub
 endif
 value_=BytesToBSTR(Http.responseBody,"GB2312")
 isGet_=True
 sethttp=nothing
 iferr.number<>0thenerr.Clear
else
 response.Write("<script>alert(""请先设置src属性!"")</script>")
endif
endsub

"删除偷到的内容中里面的换行、回车符以便进一步加工/方法
publicsubnoReturn()
ifisGet_=falsethencallsteal()
value_=replace(replace(value_,vbCr,""),vbLf,"")
endsub

"对偷到的内容中的个别字符串用新值更换/方法
publicsubchange(oldStr,str)"参数分别是旧字符串,新字符串
ifisGet_=falsethencallsteal()
value_=replace(value_,oldStr,str)
endsub

"按指定首尾字符串对偷取的内容进行裁减(不包括首尾字符串)/方法
publicsubcut(head,bot)"参数分别是首字符串,尾字符串
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
   value_=mid(value_,instr(value_,head)+len(head),instr(value_,bot)-instr(value_,head)-len(head))
  else
   value_="<palign=""center"">函数cut指定裁减内容不存在,请重新定义"
  endif
endsub

"按指定首尾字符串对偷取的内容进行裁减(包括首尾字符串)/方法
publicsubcutX(head,bot)"参数分别是首字符串,尾字符串
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
   value_=mid(value_,instr(value_,head),instr(value_,bot)-instr(value_,head)+len(bot))
  else
   value_="<palign=""center"">函数cutX指定裁减的内容不存在"
  endif
endsub

"按指定首尾字符串位置偏移指针对偷取的内容进行裁减/方法
publicsubcutBy(head,headCusor,bot,botCusor)
"参数分别是首字符串,首偏移值,尾字符串,尾偏移值,左偏移用负值,偏移指针单位为字符数
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
   value_=mid(value_,instr(value_,head)+len(head)+headCusor,instr(value_,bot)-1+botCusor-instr(value_,head)-len(head)-headcusor)
  else
   value_="<palign=""center"">函数cutBy指定裁减内容不存在"
  endif
endsub

"按指定首尾字符串对偷取的内容用新值进行替换(不包括首尾字符串)/方法
publicsubfilt(head,bot,str)"参数分别是首字符串,尾字符串,新值,新值位空则为过滤
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
   value_=replace(value_,mid(value_,instr(value_,head)+len(head),instr(value_,bot)-instr(value_,head)-len(head)),str)
  else
   value_="<palign=""center"">函数filt指定替换的内容不存在"
  endif
endsub

"按指定首尾字符串对偷取的内容用新值进行替换(包括首尾字符串)/方法
publicsubfiltX(head,bot,str)"参数分别是首字符串,尾字符串,新值,新值为空则为过滤
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
       value_=replace(value_,mid(value_,instr(value_,head),instr(value_,bot)-instr(value_,head)+len(bot)),str)
  else
   value_="<palign=""center"">函数filtX指定替换的内容不存在"
  endif
endsub

"按指定首尾字符串位置偏移指针对偷取的内容新值进行替换/方法
publicsubfiltBy(head,headCusor,bot,botCusor,str)
"参数分别是首字符串,首偏移值,尾字符串,尾偏移值,新值,左偏移用负值,偏移指针单位为字符数,新值为空则为过滤
ifisGet_=falsethencallsteal()
  ifinstr(value_,head)>0andinstr(value_,bot)>0then
   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_="<palign=""center"">函数filtBy指定替换的内容不存在"
  endif
endsub

"对符合条件的内容进行分块采集并组合,最终内容为以<!--lkstar-->隔断的大文本/方法
"通过属性value得到此内容后你可以用split(value,"<!--lkstar-->")得到你需要的数组
publicsubrebuild(str)"参数是你目标页面反复出现的特征字符
ifisGet_=falsethencallsteal()
value_=replace(value_,str,vbcrlf&"<!--lkstar-->"&vbcrlf)
endsub

"类排错模式――在类释放之前应用此方法可以随时查看你截获的内容HTML代码和页面显示效果/方法
publicsubdebug()
dimtempstr
tempstr="<SCRIPT>functionrunEx(){varwinEx2=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();}functionsaveFile(){varwin=window.open("","","top=10000,left=10000");win.document.write(document.all.asdf.innerText);win.document.execCommand("SaveAs","","javascript.htm");win.close();}</SCRIPT><center><TEXTAREAid=asdfname=textfieldrows=32 wrap=VIRTUALcols=""120"">"&value_&"</TEXTAREA><BR><BR><INPUTname=Buttononclick=runEx()type=buttonvalue=""查看效果"">  <INPUTname=Buttononclick=asdf.select()type=buttonvalue=""全选"">  <INPUTname=Buttononclick=""asdf.value=""""type=buttonvalue=""清空"">  <INPUTonclick=saveFile();type=buttonvalue=""保存代码""></center>"
response.Write(tempstr)
endsub
endclass
%>