输入歌名自动会自动联想歌名
读取音乐地址时,背景变暗不可操作
同步LRC歌词显示,
用户可自己进行扩展,整合音乐站
mp3.asp
复制代码 代码如下:
<%@language="vbscript"CodePage="936"%>
<%
response.charset="gb2312"
setregex=Newregexp
regex.IgnoreCase=True
regex.Global=True
songname=unescape(query("songname"))
SelectCasequery("s")
case"geturl":echogeturl(songname)
case"suggest":echosuggest()
Endselect
Functiongeturl(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)"
Seturls=regex.execute(page)
'Fori=0Tourls.count-1
'geturl=geturl&(mp3url(urls(i))&"<br/>")
'Next
Randomize
i=Int(rnd()*urls.count)
IfLen(urls(i))<30Theni=Int(rnd()*urls.count)
url=mp3url(urls(i))
geturl="<div>"&mplay(url)&"<ahref="""&url&""">点击鼠标右键-目标另存为下载歌曲<a></div>"
Getlrc(songname)
EndFunction
Functionmp3url(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)"
Seturls=regex.execute(page)
Ifurls.count>0Thenmp3url=urls(2)
EndFunction
Functionmplay(fileUrl)
echo"<objectclassid=""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=""LoadingMicrosoftWindowsMediaPlayercomponents...""type=""application/x-oleobject""id=""mediaPlayerObj""width:300px;height:64px;border:1pxsolid#CCCCCC"">"
echo"<paramname=""url""value='"&fileUrl&"'>"
echo"<paramname=""rate""value=""10"">"
echo"<paramname=""balance""value=""0"">"
echo"<paramname=""currentPosition""value=""0"">"
echo"<paramname=""playCount""value=""1"">"
echo"<paramname=""autoStart""value=""-1"">"
echo"<paramname=""volume""value=""60"">"
echo"<paramname=""currentMarker""value=""0"">"
echo"<paramname=""invokeURLs""value=""-1"">"
echo"<paramname=""stretchToFit""value=""-1"">"
echo"<paramname=""windowlessVideo""value=""0"">"
echo"<paramname=""enabled""value=""-1"">"
echo"<paramname=""enableContextMenu""value=""0"">"
echo"<paramname=""fullScreen""value=""0"">"
echo"<paramname=""enableErrorDialogs""value=""0"">"
echo"<embedsrc="""&fileUrl&"""align=""baseline""type=""application/x-mplayer2""pluginspage=""""id=""mediaPlayerObj""showcontrols=""1""showpositioncontrols=""0""showaudiocontrols=""1""showtracker=""1""showdisplay=""0""showstatusbar=""1""autosize=""0""showgotobar=""0""showcaptioning=""0""autostart=""1""autorewind=""0""animationatstart=""0""transparentatstart=""0""allowscan=""1""enablecontextmenu=""1""clicktoplay=""0""defaultframe=""datawindow""invokeurls=""0""width:300px;height:68px;border:1pxsolid#FF0000""></embed>"
echo"</object>"
EndFunction
SubGetlrc(songname)
echo"<divid=""lrcxx""display:none""></div>"
echo"<spanid=""lrcdata"">"
echo"<>"
echo"</span>"
echo"<divid=""bkk"">"
echo"<divid=""lrcstart"">歌词:<ahref="""&lrcurl&"""target=""new"">点击下载LRC歌词</a></div>"
echo"<divid=""lrcollbox"">"
echo"<tableid=""lrcoll""position:relative;top:30px;width:100%;text-align:center"">"
echo"<tr><td><divid=""lrcwt1""></div></td></tr>"
echo"<tr><td><divid=""lrcwt2""></div></td></tr>"
echo"<tr><td><divid=""lrcwt3""></div></td></tr>"
echo"<tr><tdclass=""kong"">"
echo"<tableborder=""0""cellspacing=""0""cellpadding=""0"">"
echo"<tr><tdnowrapheight=""30""><spanid=""lrcbox""width:0;""></span></td></tr>"
echo"<trposition:relative;top:-30px;z-index:6;""><tdnowrapheight=""30""><spanid=""lrcbc""overflow:hidden;width:0;""></span></td>"
echo"</tr>"
echo"</table>"
echo"</td></tr>"
echo"<trposition:relative;top:-30px;""><td><divid=""lrcwt4""></div></td></tr>"
echo"<trposition:relative;top:-30px;""><td><divid=""lrcwt5""></div></td></tr>"
echo"</table>"
echo"</div>"
echo"</div>"
EndSub
FunctionSuggest()
IfTrim(query("songname"))<>""then
songname=Replace((query("songname")),"!","%")
'Suggest=ajax("http://mp3.sogou.com/suggest/suggest.jsp?key="&escape(query("songname"))&"&asc=1","","","UTF-8")
Suggest=ajax("http://music.soso.com/wh.php?"&songname,"","","")
Endif
EndFunction
FunctionQuery(byvalvar)
Query=request.form(var)
ifQuery=""thenQuery=request(var)
EndFunction
FunctionEcho(byvalstr)
response.writestr
EndFunction
PublicFunctionAJAX(url,method,data,bm)
Ifmethod=""Thenmethod="get"
Ifbm=""Thenbm="gb2312"
dimhttp
Sethttp=Server.createobject("Microsoft.XMLHTTP")
Http.openmethod,url,false
ifLCase(method)="post"then
Http.setrequestheader"content-length",len(data)
Http.setrequestheader"content-type","application/x-www-form-urlencoded"
endif
Http.send(data)
ifHttp.readystate=4andHttp.status=200then
AJAX=bytesToBSTR(Http.responseBody,"GB2312")
endIf
sethttp=nothing
Endfunction
PublicFunctionBytesToBstr(body,Cset)
dimobjstream
setobjstream=Server.CreateObject("ADODB"+"."+"Stream")
withobjstream
.Type=1
.Mode=3
.Open
.Writebody
.Position=0
.Type=2
.Charset=Cset
BytesToBstr=.ReadText
.Close
endwith
setobjstream=nothing
EndFunction
Setregex=Nothing
%>
在线演示http://www.jb51.net/demo/mp4/index.html
本地下载