asp实现的7xi音乐网的采集源代码
程序员文章站
2023-11-21 17:01:04
共5个文件: 2个是配置文件: 配置文件: cfg.txt '---保存检测id信息的,第一次采集时设为1,从小到大检测 cfg.asp '---asp...
共5个文件:
2个是配置文件:
配置文件:
cfg.txt '---保存检测id信息的,第一次采集时设为1,从小到大检测
cfg.asp '---asp的配置信息,内容如下:
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 配置文件 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'
dim picc_folderpath,mp3_folderpath
dim v_7xijs_url,v_7xipicc_url,v_7xiplay_url,v_7xialbum_url,v_7ximp3_url,cfg_name,cfg_line
dim httpobj,str,str0,str1,str2,str3,str4,str5,str6,str7,str8,str9
dim is_getrm
'---音乐文件是否保存到本地,true-保存;false-不保存
is_getrm = false
'---保存路径
picc_folderpath = "h:\mp3data\images\"
mp3_folderpath = "h:\mp3data\rm\"
'---7xi相关页面
v_7xijs_url = "http://7xi.net/player/js.js"
v_7xipicc_url = "http://ww.7xi.net/picc/"
v_7xiplay_url = "http://7xi.net/playsong/"
v_7xialbum_url = "http://ww.7xi.net/vo2/"
v_7ximp3_url = "" '---实时读取
'---检测id
cfg_name = "cfg.txt"
cfg_line = 1
'---读取播放js文件,获得rm文件路径
set httpobj = server.createobject("paopao.http")
str = httpobj.get(v_7xijs_url)
str0 = split(str,"theurl2="&chr(34))
str1 = split(str0(1),chr(34))
v_7ximp3_url = str1(0)
set httpobj = nothing
str = ""
'---数据库连接
set conn = server.createobject("adodb.connection")
conn.open "driver={sql server};server=localhost;uid=mp3;pwd=mp3;database=mp3db"
'---拼sql语句execute时需要过滤一下
function indbstr(str)
if isnull(str) or str = "" then
indbstr = str
else
indbstr = replace(replace(trim(str),"'","''"),"%","")
end if
end function
'---关闭数据库连接
function closeconn()
conn.close
set conn=nothing
end function
'---取得远程文件并保存到本地
function getremotefiles(remotepath, localpath, filename)
dim strbody
dim filepath
on error resume next
'---取得流
strbody = getbody(remotepath)
'---取得保存的文件名
if right(localpath, 1) <> "\" then localpath = localpath & "\"
if not checkdir(bkfolder) then makenewsdir bkfolder
filepath = localpath & getfilename(remotepath, filename)
'---保存文件
if savetofile(strbody, filepath) = true and err.number = 0 then
getremotefiles = true
else
getremotefiles = false
end if
end function
'---远程获取内容
function getbody(url)
dim retrieval
'---建立xmlhttp对象
set retrieval = createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false, "", ""
.send
getbody = .responsebody
end with
set retrieval = nothing
end function
'---重组文件名
function getfilename(remotepath, filename)
dim arrtmp
dim strfileext
arrtmp = split(remotepath, ".")
strfileext = arrtmp(ubound(arrtmp))
getfilename = filename & "." & strfileext
end function
'---将流内容保存为文件
function savetofile(stream, filepath)
dim objstream
on error resume next
'---建立adodb.stream对象,必须要ado 2.5以上版本
set objstream = server.createobject("adodb.stream")
objstream.type = 1 '以二进制模式打开
objstream.open
objstream.write stream
objstream.savetofile filepath, 2
objstream.close()
'---关闭对象,释放资源
set objstream = nothing
if err.number <> 0 then
savetofile = false
else
savetofile = true
end if
end function
'---读取文本文件
function fsolinedit(filename,linenum)
if linenum < 1 then exit function
dim fso,f,temparray,tempcnt
set fso = server.createobject("scripting.filesystemobject")
if not fso.fileexists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.atendofstream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
if linenum>ubound(temparray)+1 then
exit function
else
fsolinedit = temparray(linenum-1)
end if
end if
end function
'---检查绝对路径是否存在
function checkfolder(folderpath)
dim fso1
set fso1 = createobject("scripting.filesystemobject")
if fso1.folderexists(folderpath) then
'存在
checkfolder = true
else
'不存在
checkfolder = false
end if
set fso1 = nothing
end function
'---根据指定名称生成目录
function makenewsdir(foldername)
dim fso1,f
set fso1 = createobject("scripting.filesystemobject")
set f = fso1.createfolder(foldername)
makenewsdir = true
set fso1 = nothing
end function
''''''''编码(日文字符)''''''''
function jencode(byval istr)
if isnull(istr) or isempty(istr) then
jencode=""
exit function
end if
dim f,i,e
e=array("jn0;","jn1;","jn2;","jn3;","jn4;","jn5;","jn6;","jn7;","jn8;","jn9;","jn10;","jn11;","jn12;","jn13;","jn14;","jn15;","jn16;","jn17;","jn18;","jn19;","jn20;","jn21;","jn22;","jn23;","jn24;","jn25;")
f=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
jencode=istr
for i=0 to 25
jencode=replace(jencode,f(i),e(i))
next
end function
''''''''解码(日文字符)''''''''
function juncode(byval istr)
if isnull(istr) or isempty(istr) then
juncode=""
exit function
end if
dim f,i,e
e=array("jn0;","jn1;","jn2;","jn3;","jn4;","jn5;","jn6;","jn7;","jn8;","jn9;","jn10;","jn11;","jn12;","jn13;","jn14;","jn15;","jn16;","jn17;","jn18;","jn19;","jn20;","jn21;","jn22;","jn23;","jn24;","jn25;")
f=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
juncode=istr
for i=0 to 25
juncode=replace(juncode,e(i),f(i))'□
next
end function
%>
1个是手动添加歌手:
addsinger.asp '---手动添加歌手,内容如下:
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 手动添加歌手 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>添加歌手分类_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim sql
dim singer_name,singer_first_name,singer_sort
singer_name = indbstr(request("singer_name"))
singer_first_name = ucase(indbstr(request("singer_first_name")))
singer_sort = request("singer_sort")
response.write "<br>歌手信息<br><br>姓名:"&singer_name&"<br>字母:"&singer_first_name&"<br>性质:"&singer_sort
sql = "insert into d_singer (singer_name,singer_first_name,singer_sort,is_down) values ('"&singer_name&"','"&singer_first_name&"','"&singer_sort&"',0)"
response.write "<br><br>"&sql
conn.execute(sql)
closeconn()
'---歌手添加完成后转入信息采集重新检测
response.write "<br><br>歌手信息检查添加完成,正在准备检查获取更新...<br>"
response.write "<meta http-equiv=refresh content=""1 ; url=get.asp"">"
%>
</body>
</html>
2个是采集程序:
get.asp '---采集歌手专辑歌曲信息,内容如下
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 歌手、专辑、歌曲信息采集 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>歌手专辑歌曲信息采集_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim t7xiid,url,folderpath,fso,fout
dim songid(100),songname(100)
dim strsinger,strlang,stralbum,strtime,strcorp,strcontent,strpicc,singerid,albumid
dim rssort,rssinger,rsalbum,rssong,i,m,sql,okimg
t7xiid = fsolinedit(cfg_name,cfg_line)
url = v_7xialbum_url&"v_"&t7xiid&".htm"
set httpobj=server.createobject("paopao.http")
err.clear
'on error resume next
str = ""
str = httpobj.get(url)
if str = "" then
closeconn()
if t7xiid < 3198 then '---没有检测到时是否递增id,继续检测
str = t7xiid + 1
folderpath = server.mappath(".\")
set fso = server.createobject("scripting.filesystemobject")
set fout = fso.createtextfile(folderpath & "\cfg.txt")
fout.writeline str
fout.close
response.write "<br>当前id号不存在,正在检查下一id号 ...<br>"
response.write "<meta http-equiv=refresh content=""0 ; url=get.asp"">"
else '---不需要递增id检测时,转到歌曲信息采集
response.write "<br>歌手专辑信息检查完毕,正在准备检查获取歌曲信息 ...<br>"
response.write "<meta http-equiv=refresh content=""0 ; url=getrm.asp"">"
response.end
end if
else
str0 = split(str,"歌 手 : ")
str1 = split(str0(1),"</td>")
strsinger = indbstr(str1(0))
response.write "<br>歌手:"&strsinger
str0 = split(str,"语 种 : ")
str1 = split(str0(1),"</td>")
strlang = str1(0)
response.write "<br>语种:"&strlang
str0 = split(str,"专 辑 : ")
str1 = split(str0(1),"</a>")
str2 = split(str1(0),""">")
stralbum = indbstr(str2(1))
response.write "<br>专辑:"&stralbum
str0 = split(str,"时 间 : ")
str1 = split(str0(1),"</td>")
strtime = str1(0)
response.write "<br>时间:"&strtime
str0 = split(str,"公 司 : ")
str1 = split(str0(1),"</td>")
strcorp = str1(0)
response.write "<br>公司:"&strcorp
str0 = split(str,"<tr valign=""top""><td colspan=""2"">")
str1 = split(str0(1),"</td>")
strcontent = replace(replace(indbstr(str1(0)),"<br>",chr(13))," "," ")
response.write "<br>简介:"&strcontent
str0 = split(str,"<img src=""../picc/")
str1 = split(str0(1),"""")
strpicc = str1(0)
response.write "<br>图片:"&strpicc
response.write "<br><img src="&v_7xipicc_url&strpicc&" border=0>"
set rssinger = conn.execute("select * from d_singer where singer_name='"&strsinger&"'")
'---歌手信息不存在时需要手动添加歌手
if rssinger.eof then
response.write "<br>select * from d_singer where singer_name='"&strsinger&"'"
response.write "<br><br>歌手不存在,需要手动操作添加。<br><br>请按以下要求添加歌手:<br><br>"
%>
<form action="addsinger.asp">
<input type="text" size="20" name="singer_name" value="<%=strsinger%>">
<input type="text" size="6" name="singer_first_name" value="姓" maxlength="3">
<select name="singer_sort" size="1"><%'%>
<%
set rssort = conn.execute("select * from s_sort ")
do while not rssort.eof and i < 10
%>
<option value="<%=rssort("id")%>"><%=rssort("sort_name")%></option><%'%>
<%
rssort.movenext
loop
rssort.close
set rssort = nothing
%></select>
<input type="submit" value="添加">
</form>
<%
closeconn()
response.end
else '---歌手信息已存在,检查专辑信息是否需要入库
singerid = rssinger("id")
conn.execute("update d_singer set is_down=0 where id="&singerid)
response.write "<br><br>歌手信息正确,正在检查获取专辑信息 ...<br>"
set rsalbum = conn.execute("select * from d_album where album_singer="&singerid&" and album_name='"&stralbum&"'")
if rsalbum.eof then
str1 = split(strpicc,".")
str2 = str1(0)
sql="insert into d_album (album_singer,file_img,album_name,album_lang,album_corp,album_time,album_intro,add_time,is_down,album_7xi) values ('"&singerid&"','"&strpicc&"','"&stralbum&"','"&strlang&"','"&strcorp&"','"&strtime&"','"&strcontent&"','"&now&"',0,"&t7xiid&")"
conn.execute(sql)
'---采集保存专辑缩略图
okimg = getremotefiles(v_7xipicc_url&strpicc,picc_folderpath,str2)
response.write "<br>专辑信息检查添加完成,正在检查获取歌曲信息 ..."&"<br>sql语句:"&sql
else
response.write "<br><br>专辑信息正确,正在准备检查获取歌曲信息 ..."
end if
rsalbum.close
set rsalbum = nothing
end if
rssinger.close
set rssinger = nothing
set rsalbum = conn.execute("select * from d_album where album_singer="&singerid&" and album_name='"&stralbum&"'")
albumid = rsalbum("id")
rsalbum.close
set rsalbum = nothing
response.write "<br><br>专辑歌曲信息<br>"
'----歌曲id
i = 1
str0 = split(str,"<input type="&chr(34)&"checkbox"&chr(34)&" name="&chr(34)&"checked"&chr(34)&" value="&chr(34))
response.write "<br>歌曲id:"
do while i <= ubound(str0)
str1 = split(str0(i),chr(34))
songid(i-1) = str1(0)
response.write songid(i-1)&" - "
i = i + 1
loop
response.write "共"&i&"首。"
'---歌曲名称
m = 1
str0 = split(str,"<a href=""../ivr.asp?id=")
response.write "<br><br>歌曲:"
do while m <= ubound(str0)
str1 = split(str0(m),""" target=""_blank""><img src=""../images/mmsring1.gif"" alt=""免费点歌")
songname(m-1) = jencode(replace(str1(0),"'","''"))
response.write juncode(songname(m-1))&" - "
m = m + 1
loop
response.write "共"&i&"首。"
'---歌曲id数目和歌曲名数目不一致时需要检查是否有误
if i <> m then
response.write "<br><br><font color=red><b>错误:</b>歌曲id数目与歌曲名数目不一致,请检查目标页面:"& url &"</font>"
response.end
end if
'---检查歌曲是否需要入库
do while i > 1
set rssong = conn.execute("select * from d_mp3 where mp3_album="&albumid&" and mp3_singer="&singerid&" and mp3_name='"&songname(i-2)&"'")
if rssong.eof then
sql = "insert into d_mp3 (mp3_7xi,mp3_singer,mp3_album,mp3_name) values ('"&songid(i-2)&"','"&singerid&"','"&albumid&"','"&songname(i-2)&"')"
conn.execute(sql)
response.write "<br><font color=red>添加:"&songname(i-2)&"</font>"
response.write sql
else
response.write "<br>跳过:"&songname(i-2)
end if
rssong.close
set rssong = nothing
i = i-1
loop
closeconn()
'---记录下一检测id号
str = t7xiid + 1
folderpath = server.mappath(".\")
set fso = server.createobject("scripting.filesystemobject")
set fout = fso.createtextfile(folderpath & "\cfg.txt")
fout.writeline str
fout.close
'---继续检测下一id
response.write "<br>正在检测下一id信息 ..."
response.write "<meta http-equiv=refresh content=""0 ; url=get.asp"">"
end if
%>
</body>
</html>
getrm.asp '---采集rm文件更新歌曲信息,内容如下:
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 歌曲文件、歌词等信息采集 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>歌曲文件歌词等信息采集_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim getcount,rssong,id,t7xiid,url,filerm,tmpurl,i,tmpfolder,okrm,singer,song,tmp_url,lyric,rs
'---每次处理歌曲数量
getcount = 5
set rssong = conn.execute("select top " & getcount & " a.*,b.singer_name from d_mp3 a,d_singer b where a.mp3_singer=b.id and a.file_rm is null order by a.id desc")
if rssong.eof then '---歌曲信息处理完成
rssong.close
set rssong = nothing
closeconn()
response.write "<br>歌曲文件信息检查采集完成!"
response.write "<br><br>采集完了,可以做垃圾站了!"
response.end
else
do while not rssong.eof
id = rssong("id")
t7xiid = rssong("mp3_7xi")
singer = replace(rssong("singer_name")," ","%20")
song = replace(rssong("mp3_name")," ","%20")
response.write "<br><br>歌曲名 - "& singer & "-" &song
'---目标页面
url = v_7xiplay_url&t7xiid&".htm"
set httpobj = server.createobject("paopao.http")
err.clear
on error resume next
response.write "<br>"&url
str = httpobj.get(url)
if err = 0 then '---读取目标页面正常时的处理
'----歌曲文件名及文件夹
str0 = split(str,"<param name='src' value='"&chr(34)&"+s_list+"&chr(34))
str1 = split(str0(1),"'>")
filerm = str1(0)
response.write "<br>文件名 - "& filerm
tmpurl = v_7ximp3_url & filerm
response.write "<br>目标源 - "& tmpurl
'---需要保存音乐文件到本地时,采集保存音乐文件
if is_getrm then
str0 = split(filerm,"/")
i = 0
do while i < ubound(str0)
tmpfolder = mp3_folderpath & str0(i)
if not checkfolder(tmpfolder) then makenewsdir tmpfolder
i = i + 1
loop
response.write "<br>保存为 - "& tmpfolder & "\" & str0(ubound(str0))
okrm = getremotefiles(tmpurl,tmpfolder,replace(str0(ubound(str0)),".rm",""))
else
response.write "<br><font color=red>请注意 - </font>rm文件配置为不保存!!!!!!!!!!"
end if
'---歌词采集
tmp_url = "http://www.7xi.net/showword.asp?id=" & t7xiid
response.write "<br>"&tmp_url
set httpobj = server.createobject("paopao.http")
str0 = httpobj.get(tmp_url)
err.clear
on error resume next
str1 = split(str0,"<td width=""92%"">"&chr(13))
str2 = split(str1(1)," </td>")
lyric = str2(0)
lyric = replace(lyric,"<br>",chr(13))
lyric = replace(lyric," "," ")
lyric = replace(replace(lyric,"<p>",""),"</p>","")
lyric = indbstr(trim(lyric))
if instr(lyric,"mp3.baidu.com") then lyric = "暂时还没歌词"
if len(lyric) < 20 or err <> 0 then
lyric = "暂时还没歌词"
response.write "<br>7xi自带歌词不完整,将采集baidu歌词"
end if
if lyric = "暂时还没歌词" then
err.clear
tmp_url = "http://mp3.baidu.com/m?f=ms&rn=10&tn=baidump3lyric&ct=150994944&word="&singer&"+"&song
response.write "<br>"&tmp_url
str0 = httpobj.get(tmp_url)
str1 = split(str0,"<b><font style=color:#e10900>"&song&"</font></b>")
if ubound(str1) >= 1 then
str2 = split(str0,"<div style=""padding-left:10px;line-height:20px;padding-top:1px"">")
str3 = split(str2(1),"</div>")
lyric = str3(0)
lyric = replace(lyric,"<br>",chr(13))
lyric = replace(lyric," "," ")
lyric = replace(lyric,"<font style=color:#e10900>","")
lyric = replace(lyric,"</font>","")
else
lyric = "暂时还没歌词"
end if
end if
response.write "<br>歌词 - "&lyric
'---将采集到的信息更新到数据库
if is_getrm then
conn.execute("update d_mp3 set file_rm='"&filerm&"',mp3_lyric='"&lyric&"',is_down='1' where id="&id)
else
conn.execute("update d_mp3 set file_rm='"&filerm&"',mp3_lyric='"&lyric&"',is_down='0' where id="&id)
end if
else '---读取目标页面出错时的处理
conn.execute("update d_mp3_t set file_rm='nourl',is_down='1' where id="&id)
response.write "<br><br><font color=red><b>错误:</b>获取目标页面错误,请检查:"& url &"</font>"
response.end
end if
rssong.movenext
loop
rssong.close
set rssong = nothing
closeconn()
'---继续检测采集下一批歌曲信息
response.write "<br>正在检测下一批歌曲信息 ...<br><br>"
response.write "<meta http-equiv=refresh content=""0 ; url=getrm.asp"">"
end if
%>
</body>
</html>
数据库表的sql脚本:
数据库表
程序代码
s_sort ----歌手分类表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[s_sort]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[s_sort]
go
create table [dbo].[s_sort] (
[id] [int] identity (1, 1) not null ,
[sort_name] [nvarchar] (20) collate chinese_prc_ci_as not null
) on [primary]
go
alter table [dbo].[s_sort] with nocheck add
constraint [pk_s_sort] primary key clustered
(
[id]
) on [primary]
go
d_singer ----歌手信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_singer]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_singer]
go
create table [dbo].[d_singer] (
[id] [int] identity (1, 1) not null ,
[singer_name] [nvarchar] (255) collate chinese_prc_ci_as null ,
[singer_first_name] [nvarchar] (50) collate chinese_prc_ci_as null ,
[singer_sort] [int] null ,
[mp3_num] [int] null ,
[is_putup] [bit] null ,
[view_count] [int] null ,
[is_down] [bit] null
) on [primary]
go
alter table [dbo].[d_singer] with nocheck add
constraint [pk_d_singer] primary key clustered
(
[id]
) on [primary]
go
d_album ----专辑信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_album]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_album]
go
create table [dbo].[d_album] (
[id] [int] identity (1, 1) not null ,
[album_singer] [int] null ,
[file_img] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_name] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_lang] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_corp] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_time] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_intro] [ntext] collate chinese_prc_ci_as null ,
[is_singer_album] [bit] null ,
[view_count] [int] null ,
[is_putup] [bit] null ,
[add_time] [datetime] null ,
[album_7xi] [int] null ,
[is_down] [bit] null
) on [primary] textimage_on [primary]
go
alter table [dbo].[d_album] with nocheck add
constraint [pk_d_album] primary key clustered
(
[id]
) on [primary]
go
d_mp3 ----歌曲信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_mp3]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_mp3]
go
create table [dbo].[d_mp3] (
[id] [int] identity (1, 1) not null ,
[mp3_name] [varchar] (200) collate chinese_prc_ci_as null ,
[mp3_album] [int] null ,
[mp3_singer] [int] null ,
[file_rm] [varchar] (100) collate chinese_prc_ci_as null ,
[file_size] [varchar] (20) collate chinese_prc_ci_as null ,
[is_putup] [bit] null ,
[mp3_lyric] [varchar] (5000) collate chinese_prc_ci_as null ,
[view_count] [int] null ,
[down_count] [int] null ,
[is_my] [bit] null ,
[mp3_7xi] [int] null ,
[is_down] [varchar] (2) collate chinese_prc_ci_as null
) on [primary]
go
alter table [dbo].[d_mp3] with nocheck add
constraint [pk_d_mp3] primary key clustered
(
[id]
) on [primary]
go
2个是配置文件:
配置文件:
cfg.txt '---保存检测id信息的,第一次采集时设为1,从小到大检测
cfg.asp '---asp的配置信息,内容如下:
复制代码 代码如下:
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 配置文件 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'
dim picc_folderpath,mp3_folderpath
dim v_7xijs_url,v_7xipicc_url,v_7xiplay_url,v_7xialbum_url,v_7ximp3_url,cfg_name,cfg_line
dim httpobj,str,str0,str1,str2,str3,str4,str5,str6,str7,str8,str9
dim is_getrm
'---音乐文件是否保存到本地,true-保存;false-不保存
is_getrm = false
'---保存路径
picc_folderpath = "h:\mp3data\images\"
mp3_folderpath = "h:\mp3data\rm\"
'---7xi相关页面
v_7xijs_url = "http://7xi.net/player/js.js"
v_7xipicc_url = "http://ww.7xi.net/picc/"
v_7xiplay_url = "http://7xi.net/playsong/"
v_7xialbum_url = "http://ww.7xi.net/vo2/"
v_7ximp3_url = "" '---实时读取
'---检测id
cfg_name = "cfg.txt"
cfg_line = 1
'---读取播放js文件,获得rm文件路径
set httpobj = server.createobject("paopao.http")
str = httpobj.get(v_7xijs_url)
str0 = split(str,"theurl2="&chr(34))
str1 = split(str0(1),chr(34))
v_7ximp3_url = str1(0)
set httpobj = nothing
str = ""
'---数据库连接
set conn = server.createobject("adodb.connection")
conn.open "driver={sql server};server=localhost;uid=mp3;pwd=mp3;database=mp3db"
'---拼sql语句execute时需要过滤一下
function indbstr(str)
if isnull(str) or str = "" then
indbstr = str
else
indbstr = replace(replace(trim(str),"'","''"),"%","")
end if
end function
'---关闭数据库连接
function closeconn()
conn.close
set conn=nothing
end function
'---取得远程文件并保存到本地
function getremotefiles(remotepath, localpath, filename)
dim strbody
dim filepath
on error resume next
'---取得流
strbody = getbody(remotepath)
'---取得保存的文件名
if right(localpath, 1) <> "\" then localpath = localpath & "\"
if not checkdir(bkfolder) then makenewsdir bkfolder
filepath = localpath & getfilename(remotepath, filename)
'---保存文件
if savetofile(strbody, filepath) = true and err.number = 0 then
getremotefiles = true
else
getremotefiles = false
end if
end function
'---远程获取内容
function getbody(url)
dim retrieval
'---建立xmlhttp对象
set retrieval = createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false, "", ""
.send
getbody = .responsebody
end with
set retrieval = nothing
end function
'---重组文件名
function getfilename(remotepath, filename)
dim arrtmp
dim strfileext
arrtmp = split(remotepath, ".")
strfileext = arrtmp(ubound(arrtmp))
getfilename = filename & "." & strfileext
end function
'---将流内容保存为文件
function savetofile(stream, filepath)
dim objstream
on error resume next
'---建立adodb.stream对象,必须要ado 2.5以上版本
set objstream = server.createobject("adodb.stream")
objstream.type = 1 '以二进制模式打开
objstream.open
objstream.write stream
objstream.savetofile filepath, 2
objstream.close()
'---关闭对象,释放资源
set objstream = nothing
if err.number <> 0 then
savetofile = false
else
savetofile = true
end if
end function
'---读取文本文件
function fsolinedit(filename,linenum)
if linenum < 1 then exit function
dim fso,f,temparray,tempcnt
set fso = server.createobject("scripting.filesystemobject")
if not fso.fileexists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.atendofstream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&chr(10))
if linenum>ubound(temparray)+1 then
exit function
else
fsolinedit = temparray(linenum-1)
end if
end if
end function
'---检查绝对路径是否存在
function checkfolder(folderpath)
dim fso1
set fso1 = createobject("scripting.filesystemobject")
if fso1.folderexists(folderpath) then
'存在
checkfolder = true
else
'不存在
checkfolder = false
end if
set fso1 = nothing
end function
'---根据指定名称生成目录
function makenewsdir(foldername)
dim fso1,f
set fso1 = createobject("scripting.filesystemobject")
set f = fso1.createfolder(foldername)
makenewsdir = true
set fso1 = nothing
end function
''''''''编码(日文字符)''''''''
function jencode(byval istr)
if isnull(istr) or isempty(istr) then
jencode=""
exit function
end if
dim f,i,e
e=array("jn0;","jn1;","jn2;","jn3;","jn4;","jn5;","jn6;","jn7;","jn8;","jn9;","jn10;","jn11;","jn12;","jn13;","jn14;","jn15;","jn16;","jn17;","jn18;","jn19;","jn20;","jn21;","jn22;","jn23;","jn24;","jn25;")
f=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
jencode=istr
for i=0 to 25
jencode=replace(jencode,f(i),e(i))
next
end function
''''''''解码(日文字符)''''''''
function juncode(byval istr)
if isnull(istr) or isempty(istr) then
juncode=""
exit function
end if
dim f,i,e
e=array("jn0;","jn1;","jn2;","jn3;","jn4;","jn5;","jn6;","jn7;","jn8;","jn9;","jn10;","jn11;","jn12;","jn13;","jn14;","jn15;","jn16;","jn17;","jn18;","jn19;","jn20;","jn21;","jn22;","jn23;","jn24;","jn25;")
f=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
juncode=istr
for i=0 to 25
juncode=replace(juncode,e(i),f(i))'□
next
end function
%>
1个是手动添加歌手:
addsinger.asp '---手动添加歌手,内容如下:
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 手动添加歌手 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>添加歌手分类_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim sql
dim singer_name,singer_first_name,singer_sort
singer_name = indbstr(request("singer_name"))
singer_first_name = ucase(indbstr(request("singer_first_name")))
singer_sort = request("singer_sort")
response.write "<br>歌手信息<br><br>姓名:"&singer_name&"<br>字母:"&singer_first_name&"<br>性质:"&singer_sort
sql = "insert into d_singer (singer_name,singer_first_name,singer_sort,is_down) values ('"&singer_name&"','"&singer_first_name&"','"&singer_sort&"',0)"
response.write "<br><br>"&sql
conn.execute(sql)
closeconn()
'---歌手添加完成后转入信息采集重新检测
response.write "<br><br>歌手信息检查添加完成,正在准备检查获取更新...<br>"
response.write "<meta http-equiv=refresh content=""1 ; url=get.asp"">"
%>
</body>
</html>
2个是采集程序:
get.asp '---采集歌手专辑歌曲信息,内容如下
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 歌手、专辑、歌曲信息采集 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>歌手专辑歌曲信息采集_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim t7xiid,url,folderpath,fso,fout
dim songid(100),songname(100)
dim strsinger,strlang,stralbum,strtime,strcorp,strcontent,strpicc,singerid,albumid
dim rssort,rssinger,rsalbum,rssong,i,m,sql,okimg
t7xiid = fsolinedit(cfg_name,cfg_line)
url = v_7xialbum_url&"v_"&t7xiid&".htm"
set httpobj=server.createobject("paopao.http")
err.clear
'on error resume next
str = ""
str = httpobj.get(url)
if str = "" then
closeconn()
if t7xiid < 3198 then '---没有检测到时是否递增id,继续检测
str = t7xiid + 1
folderpath = server.mappath(".\")
set fso = server.createobject("scripting.filesystemobject")
set fout = fso.createtextfile(folderpath & "\cfg.txt")
fout.writeline str
fout.close
response.write "<br>当前id号不存在,正在检查下一id号 ...<br>"
response.write "<meta http-equiv=refresh content=""0 ; url=get.asp"">"
else '---不需要递增id检测时,转到歌曲信息采集
response.write "<br>歌手专辑信息检查完毕,正在准备检查获取歌曲信息 ...<br>"
response.write "<meta http-equiv=refresh content=""0 ; url=getrm.asp"">"
response.end
end if
else
str0 = split(str,"歌 手 : ")
str1 = split(str0(1),"</td>")
strsinger = indbstr(str1(0))
response.write "<br>歌手:"&strsinger
str0 = split(str,"语 种 : ")
str1 = split(str0(1),"</td>")
strlang = str1(0)
response.write "<br>语种:"&strlang
str0 = split(str,"专 辑 : ")
str1 = split(str0(1),"</a>")
str2 = split(str1(0),""">")
stralbum = indbstr(str2(1))
response.write "<br>专辑:"&stralbum
str0 = split(str,"时 间 : ")
str1 = split(str0(1),"</td>")
strtime = str1(0)
response.write "<br>时间:"&strtime
str0 = split(str,"公 司 : ")
str1 = split(str0(1),"</td>")
strcorp = str1(0)
response.write "<br>公司:"&strcorp
str0 = split(str,"<tr valign=""top""><td colspan=""2"">")
str1 = split(str0(1),"</td>")
strcontent = replace(replace(indbstr(str1(0)),"<br>",chr(13))," "," ")
response.write "<br>简介:"&strcontent
str0 = split(str,"<img src=""../picc/")
str1 = split(str0(1),"""")
strpicc = str1(0)
response.write "<br>图片:"&strpicc
response.write "<br><img src="&v_7xipicc_url&strpicc&" border=0>"
set rssinger = conn.execute("select * from d_singer where singer_name='"&strsinger&"'")
'---歌手信息不存在时需要手动添加歌手
if rssinger.eof then
response.write "<br>select * from d_singer where singer_name='"&strsinger&"'"
response.write "<br><br>歌手不存在,需要手动操作添加。<br><br>请按以下要求添加歌手:<br><br>"
%>
<form action="addsinger.asp">
<input type="text" size="20" name="singer_name" value="<%=strsinger%>">
<input type="text" size="6" name="singer_first_name" value="姓" maxlength="3">
<select name="singer_sort" size="1"><%'%>
<%
set rssort = conn.execute("select * from s_sort ")
do while not rssort.eof and i < 10
%>
<option value="<%=rssort("id")%>"><%=rssort("sort_name")%></option><%'%>
<%
rssort.movenext
loop
rssort.close
set rssort = nothing
%></select>
<input type="submit" value="添加">
</form>
<%
closeconn()
response.end
else '---歌手信息已存在,检查专辑信息是否需要入库
singerid = rssinger("id")
conn.execute("update d_singer set is_down=0 where id="&singerid)
response.write "<br><br>歌手信息正确,正在检查获取专辑信息 ...<br>"
set rsalbum = conn.execute("select * from d_album where album_singer="&singerid&" and album_name='"&stralbum&"'")
if rsalbum.eof then
str1 = split(strpicc,".")
str2 = str1(0)
sql="insert into d_album (album_singer,file_img,album_name,album_lang,album_corp,album_time,album_intro,add_time,is_down,album_7xi) values ('"&singerid&"','"&strpicc&"','"&stralbum&"','"&strlang&"','"&strcorp&"','"&strtime&"','"&strcontent&"','"&now&"',0,"&t7xiid&")"
conn.execute(sql)
'---采集保存专辑缩略图
okimg = getremotefiles(v_7xipicc_url&strpicc,picc_folderpath,str2)
response.write "<br>专辑信息检查添加完成,正在检查获取歌曲信息 ..."&"<br>sql语句:"&sql
else
response.write "<br><br>专辑信息正确,正在准备检查获取歌曲信息 ..."
end if
rsalbum.close
set rsalbum = nothing
end if
rssinger.close
set rssinger = nothing
set rsalbum = conn.execute("select * from d_album where album_singer="&singerid&" and album_name='"&stralbum&"'")
albumid = rsalbum("id")
rsalbum.close
set rsalbum = nothing
response.write "<br><br>专辑歌曲信息<br>"
'----歌曲id
i = 1
str0 = split(str,"<input type="&chr(34)&"checkbox"&chr(34)&" name="&chr(34)&"checked"&chr(34)&" value="&chr(34))
response.write "<br>歌曲id:"
do while i <= ubound(str0)
str1 = split(str0(i),chr(34))
songid(i-1) = str1(0)
response.write songid(i-1)&" - "
i = i + 1
loop
response.write "共"&i&"首。"
'---歌曲名称
m = 1
str0 = split(str,"<a href=""../ivr.asp?id=")
response.write "<br><br>歌曲:"
do while m <= ubound(str0)
str1 = split(str0(m),""" target=""_blank""><img src=""../images/mmsring1.gif"" alt=""免费点歌")
songname(m-1) = jencode(replace(str1(0),"'","''"))
response.write juncode(songname(m-1))&" - "
m = m + 1
loop
response.write "共"&i&"首。"
'---歌曲id数目和歌曲名数目不一致时需要检查是否有误
if i <> m then
response.write "<br><br><font color=red><b>错误:</b>歌曲id数目与歌曲名数目不一致,请检查目标页面:"& url &"</font>"
response.end
end if
'---检查歌曲是否需要入库
do while i > 1
set rssong = conn.execute("select * from d_mp3 where mp3_album="&albumid&" and mp3_singer="&singerid&" and mp3_name='"&songname(i-2)&"'")
if rssong.eof then
sql = "insert into d_mp3 (mp3_7xi,mp3_singer,mp3_album,mp3_name) values ('"&songid(i-2)&"','"&singerid&"','"&albumid&"','"&songname(i-2)&"')"
conn.execute(sql)
response.write "<br><font color=red>添加:"&songname(i-2)&"</font>"
response.write sql
else
response.write "<br>跳过:"&songname(i-2)
end if
rssong.close
set rssong = nothing
i = i-1
loop
closeconn()
'---记录下一检测id号
str = t7xiid + 1
folderpath = server.mappath(".\")
set fso = server.createobject("scripting.filesystemobject")
set fout = fso.createtextfile(folderpath & "\cfg.txt")
fout.writeline str
fout.close
'---继续检测下一id
response.write "<br>正在检测下一id信息 ..."
response.write "<meta http-equiv=refresh content=""0 ; url=get.asp"">"
end if
%>
</body>
</html>
getrm.asp '---采集rm文件更新歌曲信息,内容如下:
程序代码
<%
'''
'''╔=======================================╗
'''┆ ┆
'''┆ @系统: 7xi音乐采集系统 version 2.0 ┆
'''┆ @模块: 歌曲文件、歌词等信息采集 ┆
'''┆ @创建: 2006/07/24 ┆
'''┆ @作者: d.s.fang ┆
'''┆ @联系: fangds@gmail.com qq-3700909 ┆
'''┆ @版权: 源码公开,无任何版权问题,您可以 ┆
'''┆ 放心使用!!!尊重作者劳动成果,请 ┆
'''┆ 保留此信息! ┆
'''┆ ┆
'''╚=======================================╝
'''
'%>
<!--#include file="cfg.asp" -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta http-equiv="content-language" content="gb2312" />
<title>歌曲文件歌词等信息采集_7xi音乐采集更新系统</title>
</head>
<body>
<br>7xi音乐采集更新系统<br><br>
<%
dim getcount,rssong,id,t7xiid,url,filerm,tmpurl,i,tmpfolder,okrm,singer,song,tmp_url,lyric,rs
'---每次处理歌曲数量
getcount = 5
set rssong = conn.execute("select top " & getcount & " a.*,b.singer_name from d_mp3 a,d_singer b where a.mp3_singer=b.id and a.file_rm is null order by a.id desc")
if rssong.eof then '---歌曲信息处理完成
rssong.close
set rssong = nothing
closeconn()
response.write "<br>歌曲文件信息检查采集完成!"
response.write "<br><br>采集完了,可以做垃圾站了!"
response.end
else
do while not rssong.eof
id = rssong("id")
t7xiid = rssong("mp3_7xi")
singer = replace(rssong("singer_name")," ","%20")
song = replace(rssong("mp3_name")," ","%20")
response.write "<br><br>歌曲名 - "& singer & "-" &song
'---目标页面
url = v_7xiplay_url&t7xiid&".htm"
set httpobj = server.createobject("paopao.http")
err.clear
on error resume next
response.write "<br>"&url
str = httpobj.get(url)
if err = 0 then '---读取目标页面正常时的处理
'----歌曲文件名及文件夹
str0 = split(str,"<param name='src' value='"&chr(34)&"+s_list+"&chr(34))
str1 = split(str0(1),"'>")
filerm = str1(0)
response.write "<br>文件名 - "& filerm
tmpurl = v_7ximp3_url & filerm
response.write "<br>目标源 - "& tmpurl
'---需要保存音乐文件到本地时,采集保存音乐文件
if is_getrm then
str0 = split(filerm,"/")
i = 0
do while i < ubound(str0)
tmpfolder = mp3_folderpath & str0(i)
if not checkfolder(tmpfolder) then makenewsdir tmpfolder
i = i + 1
loop
response.write "<br>保存为 - "& tmpfolder & "\" & str0(ubound(str0))
okrm = getremotefiles(tmpurl,tmpfolder,replace(str0(ubound(str0)),".rm",""))
else
response.write "<br><font color=red>请注意 - </font>rm文件配置为不保存!!!!!!!!!!"
end if
'---歌词采集
tmp_url = "http://www.7xi.net/showword.asp?id=" & t7xiid
response.write "<br>"&tmp_url
set httpobj = server.createobject("paopao.http")
str0 = httpobj.get(tmp_url)
err.clear
on error resume next
str1 = split(str0,"<td width=""92%"">"&chr(13))
str2 = split(str1(1)," </td>")
lyric = str2(0)
lyric = replace(lyric,"<br>",chr(13))
lyric = replace(lyric," "," ")
lyric = replace(replace(lyric,"<p>",""),"</p>","")
lyric = indbstr(trim(lyric))
if instr(lyric,"mp3.baidu.com") then lyric = "暂时还没歌词"
if len(lyric) < 20 or err <> 0 then
lyric = "暂时还没歌词"
response.write "<br>7xi自带歌词不完整,将采集baidu歌词"
end if
if lyric = "暂时还没歌词" then
err.clear
tmp_url = "http://mp3.baidu.com/m?f=ms&rn=10&tn=baidump3lyric&ct=150994944&word="&singer&"+"&song
response.write "<br>"&tmp_url
str0 = httpobj.get(tmp_url)
str1 = split(str0,"<b><font style=color:#e10900>"&song&"</font></b>")
if ubound(str1) >= 1 then
str2 = split(str0,"<div style=""padding-left:10px;line-height:20px;padding-top:1px"">")
str3 = split(str2(1),"</div>")
lyric = str3(0)
lyric = replace(lyric,"<br>",chr(13))
lyric = replace(lyric," "," ")
lyric = replace(lyric,"<font style=color:#e10900>","")
lyric = replace(lyric,"</font>","")
else
lyric = "暂时还没歌词"
end if
end if
response.write "<br>歌词 - "&lyric
'---将采集到的信息更新到数据库
if is_getrm then
conn.execute("update d_mp3 set file_rm='"&filerm&"',mp3_lyric='"&lyric&"',is_down='1' where id="&id)
else
conn.execute("update d_mp3 set file_rm='"&filerm&"',mp3_lyric='"&lyric&"',is_down='0' where id="&id)
end if
else '---读取目标页面出错时的处理
conn.execute("update d_mp3_t set file_rm='nourl',is_down='1' where id="&id)
response.write "<br><br><font color=red><b>错误:</b>获取目标页面错误,请检查:"& url &"</font>"
response.end
end if
rssong.movenext
loop
rssong.close
set rssong = nothing
closeconn()
'---继续检测采集下一批歌曲信息
response.write "<br>正在检测下一批歌曲信息 ...<br><br>"
response.write "<meta http-equiv=refresh content=""0 ; url=getrm.asp"">"
end if
%>
</body>
</html>
数据库表的sql脚本:
数据库表
程序代码
s_sort ----歌手分类表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[s_sort]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[s_sort]
go
create table [dbo].[s_sort] (
[id] [int] identity (1, 1) not null ,
[sort_name] [nvarchar] (20) collate chinese_prc_ci_as not null
) on [primary]
go
alter table [dbo].[s_sort] with nocheck add
constraint [pk_s_sort] primary key clustered
(
[id]
) on [primary]
go
d_singer ----歌手信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_singer]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_singer]
go
create table [dbo].[d_singer] (
[id] [int] identity (1, 1) not null ,
[singer_name] [nvarchar] (255) collate chinese_prc_ci_as null ,
[singer_first_name] [nvarchar] (50) collate chinese_prc_ci_as null ,
[singer_sort] [int] null ,
[mp3_num] [int] null ,
[is_putup] [bit] null ,
[view_count] [int] null ,
[is_down] [bit] null
) on [primary]
go
alter table [dbo].[d_singer] with nocheck add
constraint [pk_d_singer] primary key clustered
(
[id]
) on [primary]
go
d_album ----专辑信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_album]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_album]
go
create table [dbo].[d_album] (
[id] [int] identity (1, 1) not null ,
[album_singer] [int] null ,
[file_img] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_name] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_lang] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_corp] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_time] [nvarchar] (100) collate chinese_prc_ci_as null ,
[album_intro] [ntext] collate chinese_prc_ci_as null ,
[is_singer_album] [bit] null ,
[view_count] [int] null ,
[is_putup] [bit] null ,
[add_time] [datetime] null ,
[album_7xi] [int] null ,
[is_down] [bit] null
) on [primary] textimage_on [primary]
go
alter table [dbo].[d_album] with nocheck add
constraint [pk_d_album] primary key clustered
(
[id]
) on [primary]
go
d_mp3 ----歌曲信息表
if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[d_mp3]') and objectproperty(id, n'isusertable') = 1)
drop table [dbo].[d_mp3]
go
create table [dbo].[d_mp3] (
[id] [int] identity (1, 1) not null ,
[mp3_name] [varchar] (200) collate chinese_prc_ci_as null ,
[mp3_album] [int] null ,
[mp3_singer] [int] null ,
[file_rm] [varchar] (100) collate chinese_prc_ci_as null ,
[file_size] [varchar] (20) collate chinese_prc_ci_as null ,
[is_putup] [bit] null ,
[mp3_lyric] [varchar] (5000) collate chinese_prc_ci_as null ,
[view_count] [int] null ,
[down_count] [int] null ,
[is_my] [bit] null ,
[mp3_7xi] [int] null ,
[is_down] [varchar] (2) collate chinese_prc_ci_as null
) on [primary]
go
alter table [dbo].[d_mp3] with nocheck add
constraint [pk_d_mp3] primary key clustered
(
[id]
) on [primary]
go
上一篇: Python中的两个内置模块介绍