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&"'>"