[asp]天枫AJAX百度音乐即时听附下载 - 网站

[asp]天枫AJAX百度音乐即时听附下载

分类:js_jQuery答疑 - 常见问题 · 发布时间:2021-11-12 17:42 · 阅读:9150

输入歌名自动会自动联想歌名

读取音乐地址时,背景变暗不可操作

同步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))&"
")
    'Next
    Randomize
    i=Int(rnd()*urls.count)
    If Len(urls(i))<30 Then i=Int(rnd()*urls.count)
    url=mp3url(urls(i))
    geturl="
"&mplay(url)&"点击鼠标右键-目标另存为下载歌曲
"
    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""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
End Function

Sub Getlrc(songname)
    echo"

    echo""
    echo""
    echo""
    echo""
    echo"歌词:点击下载LRC歌词
"
    echo""
    echo""
    echo"
"
    echo"
"
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
    echo""
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
%>

在线演示https://www.0133.cn/demo/mp4/index.html
本地下载
标签:
[asp]天枫AJAX百度音乐即时听附下载

相关文章

AJAX乱码与异步同步以及封装jQuery库实现步骤详解

这篇文章主要介绍了异步通信技术AJAX乱码问题、异步与同步、手动封装一个jQuery库,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习吧

AJAX的跨域问题解决方案

跨域简单的说,就是从一个域名的网页去访问另一个域名网页的资源,下面这篇文章主要给大家介绍了关于AJAX的跨域问题解决的相关资料,文中通过实例代码介绍的非常详细,需要的朋友可以参考下

利用Ajax实现智能回答的机器人示例代码

这篇文章主要介绍了利用Ajax实现智能回答的机器人,本文结合示例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

ajax、axios和fetch之间优缺点重点对比总结

今天被问到用没用过ajax axios,我回答经常用axios,但ajax用的比较少,下面这篇文章主要给大家介绍了关于ajax、axios和fetch之间优缺点重点对比总结的相关资料,需要的朋友可以参考下

如何通过axios发起Ajax请求(最新推荐)

Axios是专注于网络数据请求的库,相比于原生的XMLHttpRequest对象,axios简单易用。相比于Jquery,axios更加轻量化,只专注于网络数据请求,这篇文章主要介绍了如何通过axios发起Ajax请求,需要的朋友可以参考下