[ASP] Day Maple Ajax Baidu Music Instant listen to download _ajax related

Source: Internet
Author: User
Enter song name automatically will associate song name automatically

Background dimming is not operational when reading music address

Sync LRC Lyrics Display,

Users can expand their own, integrated music station
screen.width-333) this.width=screen.width-333 "border=0>

screen.width-333) this.width=screen.width-333 "border=0>

screen.width-333) this.width=screen.width-333 "border=0>
Mp3.asp
Copy Code code as follows:

<%@ 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 (URL (i)) <30 Then I=int (Rnd () *urls.count)
Url=mp3url (URLs (i))
Geturl= "<div>" &mplay (URL) & "<a href=" "&url&" "" > click the right mouse button-save target as download song <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=" "Ten" ">"
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=" "Volume" "value=" ">"
echo "<param name=" "Currentmarker" "value=" "0" ">"
echo "<param name=" "Invokeurls" "value=" "1" ">"
echo "<param name=" "Stretchtofit" "value=" "1" ">"
echo "<param name=" "Windowlessvideo" "value=" "0" ">"
echo "<param name=" "Enabled" "Value=" "-1" ">"
echo "<param name=" "Enablecontextmenu" "value=" "0" ">"
echo "<param name=" "fullscreen" "value=" "0" ">"
echo "<param name=" "Enableerrordialogs" "value=" "0" ">"
echo "<embed src=" "&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" "style=" "width:300px;height:68px;border:1px Solid FF0000 "" ></embed> "
echo "</object>"
End Function

Sub GETLRC (Songname)
echo "<div id=" "Lrcxx" "style=" "Display:none" "></div>"
echo "<span id=" "Lrcdata" ">"
echo "<!--"
Page=ajax ("http://mp3.baidu.com/m?tn=baidump3lyric&word=" &songname& "&ct=150994944&lm=-1") &lf=3 "," "," "", "" "
If InStr (page, "Sorry, not Found") >0 Then
echo "didn't find the lyrics."
Lrcurl= ""
Else
Regex. Pattern= "(http://) \s+\. (LRC) "
Set Lrcs=regex. Execute (page)
Lrcurl=lrcs (0)
If lrcs.count>0 Then
Echo Ajax (Lrcurl, "", "", "")
Else
echo "didn't find the lyrics."
End If
End If
echo "-->"
echo "</span>"
echo "<div id=" "BKK" ">"
echo "<div id=" "Lrcstart" "> Lyrics: <a href=" "&lrcurl&" "" target= "" New "" > Click to download LRC lyrics </a></ Div> "
echo "<div id=" "Lrcollbox" ">"
echo "<table id=" "Lrcoll" "style=" "Position:relative;top:30px;width:100%;text-align:center" ">"
echo "<tr><td><div id=" "Lrcwt1" "></div></td></tr>"
echo "<tr><td><div id=" "Lrcwt2" "></div></td></tr>"
echo "<tr><td><div id=" "Lrcwt3" "></div></td></tr>"
echo "<tr><td class=" "Kong" ">"
echo "<table border=" "0" "cellspacing=" "0" "cellpadding=" "0" ">"
echo "<tr><td nowrap height=" "><span id=" "Lrcbox" "style=" "width:0" " ></span></td></tr> "
echo "<tr style=" "position:relative; Top: -30px; Z-index:6; "" &GT;&LT;TD nowrap height= "" "" ><span id= "" LRCBC "" style= "" Overflow:hidden "; width:0; "" ></span></td> "
echo "</tr>"
echo "</table>"
echo "</td></tr>"
echo "<tr style=" "position:relative; Top: -30px; "" ><td><div id= "Lrcwt4" "></div></td></tr>"
echo "<tr style=" "position:relative; Top: -30px; "" ><td><div id= "Lrcwt5" "></div></td></tr>"
echo "</table>"
echo "</div>"
echo "</div>"
End Sub

Function suggest ()
If Trim (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, "", "" "," ")
End If
End Function

Function Query (ByVal var)
Query = Request.Form (Var)
If query = "" Then query = Request (VAR)
End Function

Function Echo (ByVal str)
Response.Write Str
End Function


Public Function AJAX (URL,METHOD,DATA,BM)
If method= "" Then method= "Get"
If bm= "" Then bm= "gb2312"
Dim http
Set http=server.createobject ("Microsoft.XMLHTTP")
Http.open Method,url,false
If LCase (method) = "POST" Then
Http.setrequestheader "Content-length", Len (data)
Http.setrequestheader "Content-type", "application/x-www-form-urlencoded"
End If
Http.send (data)
If http.readystate=4 and http.status=200 then
Ajax=bytestobstr (Http.responsebody, "GB2312")
End If
Set http=nothing
End Function

Public 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

Set regex=nothing
%>

Online Demo http://www.jb51.net/demo/mp4/index.html
Local Downloads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.