
<%option explicit%>
<%
if request("key")<>"" then
'#########检测输入的关键字是否为空#########
dim Key,lm
 Key=Request("Key")
 lm=request("lm")
 Key=server.URLEncode(Key)
 if len(Key)=0 then
 Response.write "请输入您想听的歌曲!"
 Response.end
 End If
'#########  偷取远程网页代码过程  #########
Function GetPage(url)
on error resume next
dim http 
Set http=Server.createobject("Microsoft.XMLHTTP") 
Http.open "get",url,false
Http.send() 
if Http.readystate<>4 then
exit function 
end if 
GetPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing 
End function
'#########     解决乱码问题过程   #########
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
with objstream
  .Type = 1
  .Mode =3
  .Open
  .Write body
  .Position = 0
  .Type = 2
  .Charset = Cset
  BytesToBstr = .ReadText 
  .Close
end with
  set objstream = nothing
 End Function
'#########    需要偷取的URL地址   #########
dim url,wordurl
if lm=0 then
	url="http://mp3.baidu.com/m?f=ms&tn=baidump3&ct=134217728&lf=&rn=&word="&key&"&lm=0"
elseif lm=1 then
	url="http://mp3.baidu.com/m?f=ms&tn=baidump3&ct=134217728&lf=&rn=&word="&key&"&lm=1"
elseif lm=2 then
	url="http://mp3.baidu.com/m?f=ms&tn=baidump3&ct=134217728&lf=&rn=&word="&key&"&lm=2"
end if
wordurl="http://mp3.baidu.com/m?tn=baidump3lyric&word="&key&"&ct=150994944&lm=-1&lf=3"		
 dim Page,start,Strend
 Page=GetPage(url)
'#########  搜索匹配正则式的数据  #########
dim rep,str1,newstr,i
Set rep = New RegExp
rep.Global = True      '设置模式为全局匹配
rep.IgnoreCase = True  '不区分大小写匹配
if lm=0 then
	rep.Pattern = "(http|rtsp|pnm):\/\/\w+\.\w+\.(com|net|cn|com.cn|net.cn)\/\S+\.mp3"
elseif lm=1 then
	rep.Pattern = "(http|rtsp|pnm):\/\/\w+\.\w+\.(com|net|cn|com.cn|net.cn)\/\S+\.rm"
elseif lm=2 then
	rep.Pattern = "(http|rtsp|pnm):\/\/\w+\.\w+\.(com|net|cn|com.cn|net.cn)\/\S+\.wma"
end if
str1=Page
set newstr=rep.Execute(str1)   '搜索str1,并返回newstr数组
dim Rndnum
if newstr.count=0 then
Response.write"找不到这首歌,请想想是否输错!"
Response.end
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="keywords" content="成都市芙蓉网络科技有限公司">
<meta name="description" content="成都市芙蓉网络科技有限公司">
<title>搜歌--搜遍天下所有的歌在线播放和下载</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 14px;
}
INPUT {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px
}
body {
	background-color: #FF6666;
}
-->
</style>
</head>
<body text="#FFFFFF" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">

<div align="center">
  <SCRIPT LANGUAGE="JavaScript"> window.resizeTo(350 ,350);</script>
</div>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
  <tr>
  <td align="center" colspan="3">
  <object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="qtdj_player" width="300" height="60">
	  <param name="AUTOSTART" value="1">
	  <param name="SHUFFLE" value="0">
	  <param name="PREFETCH" value="0">
	  <param name="NOLABELS" value="0">
	  <param name="LOOP" value="1">
	  <param name="NUMLOOP" value="0">
	  <param name="CENTER" value="0">
	  <param name="MAINTAINASPECT" value="0">
	  <param name="BACKGROUNDCOLOR" value="#000000">
	  <param name="CONTROLS" value="StatusBar,,controlpanel">
  </object>
  <script language=vbscript>
'===========音乐地址自动抓取系统===========
'=========== 侦错自动换地址模式 ===========
Dim Aurl
<% 
Dim a
a=0
Response.write "Aurl=Array(" & chr(34) & newstr(a) & chr(34)
While a < newstr.count - 1
a=a+1
Response.write "," & chr(34) & newstr(a) & chr(34) 
Wend
Response.write ")"
%>
Dim i
i=0
qtdj_player.SetWantErrors True
qtdj_player.SetAutoStart True
qtdj_player.Source = Aurl(i)
Private Sub qtdj_player_OnErrorMessage(uSeverity,uRMACode,uUserCode,pUserString,pMoreInfoURL,pErrorString)
<%
if newstr.count=1 then
Response.write "alert(""这是搜索到得唯一资源,不能试听,真是太遗憾了!"")" & VbCrLf
Response.write "window.close()"
else
Response.write "Randomize" & VbCrLf
Response.write "i=Int(rnd * " & newstr.count - 1 & ")" & VbCrLf
Response.write "qtdj_player.SetSource Aurl(i)" & VbCrLf
Response.write "qtdj_player.DoPlay"
End If
%>
End Sub

Private Sub UUpdate()
<%
if newstr.count=1 then
Response.write "alert(""这是搜索到得唯一资源,就将就一下吧!"")" & VbCrLf
Response.write "window.close()"
else
Response.write "Randomize" & VbCrLf
Response.write "i=Int(rnd * " & newstr.count - 1 & ")" & VbCrLf
Response.write "qtdj_player.SetSource Aurl(i)" & VbCrLf
Response.write "qtdj_player.DoPlay"
End If
%>
End Sub

Private Sub DownU()
window.open(Aurl(i))
End Sub
</script>
  
</td>
  </tr>
  <tr>
  <td height="49" colspan="3" onclick=vbscript:UUpdate()>[有效链接地址有:<font color=red><%=newstr.count%></font>个]<input type="button" value="更换链接地址"></td>
  </tr> 
  <tr>
  <td colspan=2 onclick="vbscript:downU()"><a href="#">下载音乐</a></td>
  <td width="35%"><a href="<%=wordurl%>" target="_blank">查看歌词</a></td>
  </tr>
  <tr>
  <td colspan=3><div align="center"></div>
    <form action="mp3.asp" method="get">
  输入歌曲:<input type="text" name="key" size="20" value="<%=request("key")%>">
  <input type="submit" value="开始听歌">
  <label for="Mp3">　　　
  <input name=lm type=radio id="radio" value=0 <%if request("lm")=0 then response.write"checked"%>>
  mp3</label>
  <label for="label4">
  <input name=lm type=radio id="label4" value=1 <%if request("lm")=1 then response.write"checked"%>>
  rm</label>
  <label for="label5">
  <input name=lm type=radio id="label5" value=2 <%if request("lm")=2 then response.write"checked"%>>
  wma</label>
  </form></td>
  </tr>
</table>
<div align="center">搜歌--搜遍天下所有的歌在线播放和下载</div>
</body>
</html>
<%else%>
<html>
<body>
<title>搜歌--搜遍天下所有的歌在线听下载</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 14px;
}
INPUT {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px;  BORDER-RIGHT-WIDTH: 1px
}
-->
</style>
</head>
<body bgcolor="#FF6666" text="#FFFFFF" link="#FFFFFF" vlink="#FF0000" alink="#FFFFFF">
<SCRIPT LANGUAGE="JavaScript"> window.resizeTo(350 ,350);</script>
<br><br><br><br><br>
<form action="mp3.asp" method="get">
输入歌曲:<input type="text" name="key" size="20">
<input type="submit" value="开始听歌">
<div align="center">
<label for="Mp3"><input name=lm type=radio id="Mp3" value=0 <%if request("lm")=0 then response.write"checked"%>>mp3</label>
<label for="RM"><input name=lm type=radio id="RM" value=1 <%if request("lm")=1 then response.write"checked"%>>rm</label>
<label for="WMA"><input name=lm type=radio id="WMA" value=2 <%if request("lm")=2 then response.write"checked"%>>wma</label>
</div>
</form>
<div align="center">搜歌--搜遍天下所有的歌在线听下载
</body>
</html>
<%end if%>