用XMLHTTP很好的一个例子
作者:佚名 来源:新云 发布时间:2008-04-25 10:25:00
虽然ting88没有注册的用户不能下载歌曲,但搞定它也非难事啊:)
进入www.ting88.com的网站,把歌手专辑页面的URL复制到文本框中再提交就可以得到歌曲的下载路径,如:http://www.ting88.com/MusicList/4141.htm
源程序如下:
<%
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>


猜你喜欢
- 随着十几年前“用户体验”这一概念的提出,“用户研究”也逐渐发展成为一个新兴的行业。那么,“用户研究”究竟包括哪些工作内容,在企业中如何开展,
- 本文实例为大家分享了python实现复制大量文件的具体代码,供大家参考,具体内容如下本来是去项目公司拷数据,结果去了发现有500G,靠系统的
- torch.nn.CrossEntropyLoss交叉熵损失本文只考虑基本情况,未考虑加权。torch.nnCrossEntropyLoss
- 在写代码的时候,往往会漏掉日志这个关键因素,导致功能在使用的时候出错却无法溯源。其实,只需要写一个非常简单的日志装饰器,我们就能大大提升排查
- 目录1. 术语说明2. 简单字段名2.1 简单字段名的说明2.2 省略字段名2.3 数字形式的简单字段名2.4 变量名形式的简单字段名2.5
- 前言最近因为业务需求,就写了这个脚本,脚本完成的任务是从FTP上下载一个目录,大家都知道从FTP上下载一个文件可用用get命令,下载多个文件
- 1. 云开发简介由于小程序本身存储数据的能力有限,所以不可能将大量的数据保存在客户端,而且将数据保存在本地既不安全,也无法与其他小程序用户共
- 本文实例讲述了Python编程之序列操作。分享给大家供大家参考,具体如下:#coding=utf8''''&
- 1. 换源地址# 中科大deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-
- 首先要有一个概念:并不是一个语言支持函数,这个语言就可以叫做“函数式语言”。函数式语言中的函数(function),除了能被调用之外,还具有
- 目录前言一、一元判断1.1 举个例子🌰1.2 放入 Object 中1.3 放入 Map 中二、多元判断2.1 举个例子🌰2.2 将判断条件
- 终于找到bug原因!记一下;还是不熟悉平台的原因造成的! Q:为什么会出现两个模型对象在同一个文件中一起运行,当直接读取他们分开运行时训练出
- Pandas最初被作为金融数据分析工具而开发出来,因此,pandas为时间序列分析提供了很好的支持。Pandas的名称来自于面板数据(pan
- 一.创建正则表达式1.re模块 所有python的正则表达式都在re模块中,使用时导入import rere模块的compile(
- 目录一 背景二 库简介三 代码3.1 创建表格3.2 增加row3.3 增加column3.4 打印表格3.5 边框操作3.6 输出json
- 前言在Vue3响应式对象是如何实现的(1)中,我们已经从功能上实现了一个响应式对象。如果仅仅满足于功能实现,我们就可以止步于此了。但在上篇中
- PHP的类是单一继承模式,也就是每个类只能继承一个父类(基类)。但有时需要引入更多通用(共用)的方法,同时这些方法又不适合集成到基类。那么这
- 1、MySQL默认存储引擎的变迁在MySQL 5.1之前的版本中,默认的搜索引擎是MyISAM,从MySQL 5.5之后的版本中,默认的搜索
- 新搞了台linux云主机,瞎折腾折腾,先装个Python3。Linux环境下有其他软件需要Python2,如YUM,所以安装的Python3
- (1)设计一个算法,确定两个矩形是否相交(即有重叠区域) (2)如果两个矩形相交,设计一个算法,求出相交的区域矩形 (1) 对于这个问题,一