小偷程序和采集入库

来源:互联网 发布:java创建文件服务器 编辑:程序博客网 时间:2024/05/02 01:53
<html> 
<% 
'声明取得目标信息的函数,通过XML组件进行实现 
Function GetURL(url) 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "GET", url, False 
.Send 
GetURL = bytes2bstr(.responsebody) 
'对取得信息进行验证,如果信息长度小于100则说明截取失败 
if len(.responsebody)<100 then 
response.write "获取远程文件 <a href="&url&" target=_blank>"&url&"</a> 失败。" 
response.end 
end if 

End With 
Set Retrieval = Nothing 
End Function 
' 二进制转字符串,否则会出现乱码的! 
function bytes2bstr(vin) 
strreturn = "" 
for i = 1 to lenb(vin) 
thischarcode = ascb(midb(vin,i,1)) 
if thischarcode < &h80 then 
strreturn = strreturn & chr(thischarcode) 
else 
nextcharcode = ascb(midb(vin,i+1,1)) 
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) 
i = i + 1 
end if 
next 
bytes2bstr = strreturn 
end function 
'声明截取的格式,从Start开始截取,到Last为结束 
Function GetKey(HTML,Start,Last) 
filearray=split(HTML,Start) 
filearray2=split(filearray(1),Last) 
GetKey=filearray2(0) 
End Function 

Dim Softid,Url,Html,Title,typeid,where,content,domurl,name,movietype,murl 

'获取要取页面的ID 

Softid=Request("Id") 

Url="
http://www.bb60.com/moviehtm/"&SoftId&".htm" 

Html = GetURL(Url) 

'以截取天空软件的软件名为例子 

Title = GetKey(Html,"><b><font color=""#FF0000"">","</font></b></font>") 
typeid = GetKey(Html,"影片分类: ","</TD>") 
content = GetKey(Html,"0000 size=3>","</font></P>") 
domurl = GetKey(Html,"../softimg/","""><br>") 
name = GetKey(Html,"主 演: ","</TD>") 
murl = GetKey(Html,"onClick= Play('../","')>播放1") 

set rs=server.createobject("adodb.recordset") 
sql="select * from learning where (articleid is null)" 
rs.open sql,conn,1,3 
rs.addnew 
rs("serverip")="122" 
rs("typeid")=typeid 
rs("softlevel")="5" 
rs("title")=title 
rs("content")=content 
rs("onlinelook")="1" 
rs("canlook")="0" 
rs("howlong")="90" 
rs("url")=murl 
rs("domurl")="
http://www.bb60.com/softimg/"&murl&"" 
rs("name")=name 
rs("count")="0" 
rs("movietype")="mov" 
rs.update 
articleid=rs("articleid") 
rs.close 


set rs=server.createobject("adodb.recordset") 
sql1="select * from movieurl where (id is null)" 
rs.open sql1,conn,1,3 
for i=1 to no 
rs.addnew 
url=trim(murl) 
rs("nameid")=articleid 
rs("url")=url 
rs.update 
next 

rs.close 
set rs=nothing 
conn.close 
set conn=nothing 

%