网学网为需要Ajax的朋友们搜集整理了[asp]天枫AJAX百度音乐即时听附下载相关资料,希望对各位网友有所帮助!
输入歌名自动会自动联想歌名
读取音乐地址时,背景变暗不可操作
同步LRC歌词显示,
用户可自己进行扩展,整合音乐站
mp3.asp
复制代码 代码如下:
<%@ language="
vbscript" CodePage="936"%>
<%
response.charset="gb2312"
set regex = New regexp
regex.IgnoreCase=True
regex.Global=True
songname=unescape(query("songname"))
Select Case query("s")
case"geturl":echo geturl(songname)
case"suggest":echo suggest()
End select
Function geturl(songname)
page=ajax("http://mp3.baidu.com/m?f=ms&tn=baidump3&ct=134217728&lf=&rn=&word="&songname&"&lm=0","","","")
regex.Pattern="(http)\S+\.(mp3)"
Set urls= regex.execute(page)
''For i=0 To urls.count-1
''geturl=geturl&(mp3url(urls(i))&"<br/>")
''Next
Randomize
i=Int(rnd()*urls.count)
If Len(urls(i))<30 Then i=Int(rnd()*urls.count)
url=mp3url(urls(i))
geturl="<div>"&mplay(url)&"<a href="""&url&""">点击鼠标右键-目标另存为
下载歌曲<a></div>"
Getlrc(songname)
End Function
Function mp3url(url)
page=ajax("http://box.zhangmen.baidu.com/m?gate=1&ct=134217728&tn=baidumt,&word=mp3,"&url&"&lm=16777216","","","")
regex.Pattern="(http)\S+\.(mp3)"
Set urls= regex.execute(page)
If urls.count>0 Then mp3url=urls(2)
End Function
Function mplay(fileUrl)
echo"<object classid=""CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"" codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"" align=""baseline"" standby=""Loading Microsoft Windows Media Player components..."" type=""application/x-oleobject"" id=""mediaPlayerObj"" style=""width:300px;height:64px;border:1px solid #CCCCCC"">"
echo"<param name=""url"" value=''"&fileUrl&"''>"
echo"<param name=""rate"" value=""10"">"
echo"<param name=""balance"" value=""0"">"
echo"<param name=""currentPosition"" value=""0"">"
echo"<param name=""playCount"" value=""1"">"
echo"<param name=""autoStart"" value=""-1"">"
echo"<param name=""v