用XMLHTTP很好的一个例子

TSD 2004-09-17 09:55:54
用XMLHTTP很好的一个例子


虽然ting88没有注册的用户不能下载歌曲,但搞定它也非难事啊:)

进入www.ting88.com的网站,把歌手专辑页面的URL复制到文本框中再提交就可以得到歌曲的下载路径,如:http://www.ting88.com/MusicList/4141.htm

http://www.0086sex.com/getmusic.asp

要源码的可以留言说明
...全文
999 60 打赏 收藏 转发到动态 举报
写回复
用AI写文章
60 条回复
切换为时间正序
请发表友善的回复…
发表回复
greennba99 2005-06-30
  • 打赏
  • 举报
回复
向您学习!!!!
xujin.net@gmail.com
gatey 2005-03-29
  • 打赏
  • 举报
回复
没有用的啊!
TSD 2004-09-20
  • 打赏
  • 举报
回复
邮件地址太多了,只好把源码贴到这里了

实现原理:

1、用XMLHTTP获取网页的源码

2、解密文件名,服务器地址和解密可以在它们网站的一个JS中看出

3、列出歌曲文件地址
TSD 2004-09-20
  • 打赏
  • 举报
回复
用XMLHTTP很好的一个例子

<%
on error resume next
dim id,url,getCode,m,i,j,s,d,ns,nd,num,name
id=trim(request.querystring("id"))
'1.获取原网页所有内容
Function getHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End function

'2.编码转换
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

'得到明码URL
function MyReplace(ConvStr)
ConvStr=replace(ConvStr,"YVI","1")
ConvStr=replace(ConvStr,"ESR","2")
ConvStr=replace(ConvStr,"SXN","3")
ConvStr=replace(ConvStr,"STI","4")
ConvStr=replace(ConvStr,"WFU","5")
ConvStr=replace(ConvStr,"LQU","6")
ConvStr=replace(ConvStr,"QGI","7")
ConvStr=replace(ConvStr,"BLA","8")
ConvStr=replace(ConvStr,"JFU","9")
ConvStr=replace(ConvStr,"LSN","0")
ConvStr=replace(ConvStr,"XPG","/")
ConvStr=replace(ConvStr,"XQD",".")
ConvStr=replace(ConvStr," ","")
ConvStr=replace(ConvStr,"%20","")
ConvStr=replace(ConvStr,"KWD","Wma")
MyReplace=ConvStr
end function

if id="1" then
url=trim(request.form("txturl"))
if url="" then
response.redirect("GetMusic.asp")
response.end()
end if
'url="http://www.ting88.com/MusicList/1454.htm"
s=0
d=0
ns=0
nd=0
getCode=getHTTPPage(url)
num=mid(getCode,instrrev(getCode,".<a href")-3,2) '获取歌曲的数目
name=mid(getCode,instr(getCode,"歌手姓名:")+5,10) '获取歌手
m="http://218.75.78.189/33445566/"
response.write "<center>该面页共找到 " & name & "的 <font color=red>" & num& "</font> 首歌曲" & "<br><br>"
response.write "<table width='80%' border='1' bordercolor='#A4C8FF' cellpadding='0' cellspacing='0'><tr><td>页面URL:<a href='" & url & "' target='_blank'>" & url & "</a></td></tr></table><hr width='80%'>"
response.write "<table width='80%' border='0' cellpadding='0' cellspacing='0' bgcolor='#A4C8FF'><tr><td><table border='0' width='100%' cellpadding='2' cellspacing='1'><tr><td align=center bgcolor='#FFFFFF'>序号</td><td align=center bgcolor='#FFFFFF'>歌名</td><td align=center bgcolor='#FFFFFF'>操作</td></tr>"
for i=1 to num
s=instr(i+s,getCode,"checked"" value='")
d=instr(i+d,getCode,"KWD'>")
ns=instr(i+ns,getCode,"word=")
nd=instr(i+nd,getCode,"&inc=")
response.write " <tr><td align=center bgcolor='#FFFFFF'>" & i & "</td><td bgcolor='#FFFFFF'> <a href='" & m & MyReplace(mid(getCode,s+16,d-s-13)) & "'>" & mid(getCode,ns+5,nd-ns-5) & "</a><br></td><td align=center bgcolor='#FFFFFF'><a href='" & m & MyReplace(mid(getCode,s+16,d-s-13)) & "'>下载</a></td></tr>"
next
response.write "</table></td></tr></table></center>"
end if



%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>获取专辑歌曲的URL地址</title>
</head>
<body>
<form name="form1" method="post" action="GetMusic.asp?id=1">
<table width='80%' border='0' align="center" cellpadding='0' cellspacing='0' bgcolor='#A4C8FF'>
<tr><td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr>
<td height="30">获取专辑歌曲的URL地址</td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF">网页地址:
<input name="txturl" type="text" id="txturl" size="80" maxlength="100"></td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF"> <input type="submit" name="Submit" value="提 交" style="width:60">
<input name="Reset" type="reset" id="Reset" value="重 置" style="width:60"></td>
</tr>
</table></td></tr></table>
</form>
</body>
</html>
sonygod 2004-09-18
  • 打赏
  • 举报
回复
好啊好啊
sonygod1@21cn.com
荣之梦 2004-09-18
  • 打赏
  • 举报
回复
真牛啊!~~~
bluecobra 2004-09-18
  • 打赏
  • 举报
回复
sounda@sina.com
nacreous 2004-09-18
  • 打赏
  • 举报
回复
大哥你太厉害了
我要一份

roundelay@126.com
LvchenFeng 2004-09-18
  • 打赏
  • 举报
回复
认真学习....

lvsv4@sina.com
顺子 2004-09-18
  • 打赏
  • 举报
回复
學習~~~~
shunzi120@163.com
element008 2004-09-18
  • 打赏
  • 举报
回复
学习!
element008@163.com
DARKNESSFALL 2004-09-18
  • 打赏
  • 举报
回复
晕!楼主怎么还不发?

借孟老大的发给大家:
<script>
var oDiv
var xh
function getXML()
{
oDiv = document.all.m
oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("GET",a.value,true)
xh.send()

}

function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{

oDiv.innerHTML = "完成"
}
else
{
oDiv.innerHTML = "抱歉,装载数据失败。原因:" + xh.statusText
}
}
}
</script>
<body>
xmlhttp异步的例子:
URL:<input name=a style="width:600px">
<input onclick="getXML()" type="button" value="得到源代码">
<input onclick="if(xh && xh.responseText) {alert(xh.responseText);oDiv.innerHTML=xh.responseText}" type="button" value="显示源代码">
<div id=m></div>
phyllis2001 2004-09-18
  • 打赏
  • 举报
回复
一般吧~~只是对ting88.com有用,换成chinamp3.com就不行了~~
jedy_1997 2004-09-18
  • 打赏
  • 举报
回复
xiaoleizhi@163.com

thanks
topzhp 2004-09-18
  • 打赏
  • 举报
回复
学习
topzhp@21cn.com
ta0004073 2004-09-18
  • 打赏
  • 举报
回复
给个看看:)
yao.zhao@gmail.com
sh5281 2004-09-18
  • 打赏
  • 举报
回复
学习

sh5281@sina.com
xiaozx 2004-09-18
  • 打赏
  • 举报
回复
学习
xiaozx@163.com
咏帆 2004-09-18
  • 打赏
  • 举报
回复
给我一份~~

学习一下

jjx520@21cn.com
zql2008 2004-09-18
  • 打赏
  • 举报
回复
大哥 我也要一份,谢谢
zql2008@21cn.com
加载更多回复(40)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧