📄 function.asp
字号:
<%
'取远程网页内容
Function GetBody(weburl)
'创建对象
Dim ObjXMLHTTP
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
'请求文件,以异步形式
ObjXMLHTTP.Open "GET",weburl,False
ObjXMLHTTP.send
While ObjXMLHTTP.readyState <> 4
ObjXMLHTTP.waitForResponse 1000
Wend
'得到结果
GetBody=BytesToBstr(ObjXMLHTTP.responseBody,"gb2312")
'释放对象
Set ObjXMLHTTP=Nothing
End Function
'转换编码
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
'取mp3或wma内容
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
if (instr(Match.Value,".mp3") or instr(Match.Value,".wma")) and instr(Match.Value,"javascript")<=0 and instr(Match.Value,"收藏")<=0 then
body=body&Match.Value&"<>" '循环匹配
end if
Next
End Function
'去除html
function nohtml(str)
dim re
'str=replace(replace(str,"<br>",vbcrlf),"<BR>",vbcrlf)'就是把它换成vbscript的换行就行了
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(\<.[^\<]*\>)"
str=re.replace(str," ")
re.Pattern="(\<\/[^\<]*\>)"
str=re.replace(str," ")
nohtml=str
set re=nothing
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -