使用Flash DownLoad編寫采集器(之突破防盜連下載音樂文件)第3/4頁
更新時間:2007年02月22日 00:00:00 作者:
<Script Language="VBScript">
Dim IStr,StrSave,StrCookie
Dim CAIType
Dim MusicBody,MusicNameArr,MusicURLArr,MusicCount,MusicPtr,MusicName,MusicPlayer,MusicURL,MusicSave
Set IStr = CreateObject("IVVN.String")
'msgbox IStr.Version
FDown.BackColor = "#FFFFFF"
FDown.FillColor = "#FFFFFF"
FDown.FrameColor = "#E0E0E0"
'=============================================================================================================================================================
'FDown事件模塊 開始
'=============================================================================================================================================================
'下載庫通過該函數(shù)通知下載狀態(tài)
Private Sub FDown_Status(ByVal lIndex, ByVal lStatus, ByVal bstrStatusParam)
On Error Resume Next
If blnDStop = True Then
FDown.bStop
Exit Sub
End If
document.getElementById("DownForm").innerText = FDown.Url
If FDown.DownLoadType = dtToFile And FDown.SavePath <> "" And FDown.Filename <> "" Then
document.getElementById("DownTo").innerText = FDown.SavePath & "\" & FDown.Filename
Else
document.getElementById("DownTo").innerText = "抓取數(shù)據(jù)..."
End If
Dim strMsg
strMsg = "線程" & lIndex + 1 & ":"
If lStatus = 0 Then
strMsg = strMsg & "解析域名 "
ElseIf lStatus = 1 Then
strMsg = strMsg & "獲得IP地址 "
ElseIf lStatus = 2 Then
strMsg = strMsg & "連接服務器 "
ElseIf lStatus = 3 Then
strMsg = strMsg & "連接服務器成功 "
ElseIf lStatus = 4 Then
strMsg = strMsg & "重定向到 "
ElseIf lStatus = 5 Then
strMsg = strMsg & "開始接收數(shù)據(jù) "
ElseIf lStatus = 6 Then
strMsg = strMsg & "下載結(jié)束 "
End If
strMsg = strMsg & bstrStatusParam & vbCrLf
document.getElementById("DownState").innerText = strMsg
End Sub
'下載庫通過該事件通知文件下載進度
Private Sub FDown_Progress(ByVal dbFileSize, ByVal dbFinished, ByVal dbSpeed)
On Error Resume Next
If blnDStop = True Then
FDown.bStop
Exit Sub
End If
Dim BFile
Dim BRead
Dim BShare
Dim BSpeed
BFile = dbFileSize
BRead = dbFinished
BShare = dbFinished / (dbFileSize / 100)
BSpeed = dbSpeed
If IsNumeric(dbFinished) = True And IsNumeric(dbFileSize) = True Then
BFile = dbFileSize
BRead = dbFinished
BShare = dbFinished / (dbFileSize / 100)
pb.setModel(BRead/BFile)
document.getElementById("DownLoading").innerText = BRead & " of " & BFile & " transferred (" & Round(BShare, 2) & "%)"
End If
If IsNumeric(dbSpeed) = True Then
BSpeed = dbSpeed
document.getElementById("DownSpeed").innerText = "Throughput " & BSpeed & " /s"
End If
End Sub
'下載庫通過該事件通知下載過程結(jié)束
Private Sub FDown_DownloadEnd(ByVal bSuccess)
On Error Resume Next
Select Case CAIType
Case "C1"
StrBody = FDown.Body
oSpecialName = IStr.RegContent(StrBody,"專輯名稱:","</li>")
document.getElementById("SpecialName").value = oSpecialName
oSinGer = IStr.RegContent(StrBody,"歌手名稱:","</li>")
document.getElementById("SinGer").value = oSinGer
oGongSi = IStr.RegContent(StrBody,"唱片公司:","</li>")
document.getElementById("GongSi").value = oGongSi
oYuYan = IStr.RegContent(StrBody,"專輯語種:","</li>")
document.getElementById("YuYan").value = oYuYan
oTimes = IStr.RegContent(StrBody,"發(fā)行時間:","</li>")
document.getElementById("Times").value = oTimes
oPIC = IStr.RegContent(StrBody,"<div class=""rightcolumn""><div id=""albuminfo""><img src=""",""">")
document.getElementById("PIC").value = oPIC
oremark = IStr.RegContent(StrBody,"<h2>專輯介紹</h2><p>","</p>")
document.getElementById("remark").value = oremark
StrSave = document.getElementById("SavePath").value & "\" & oSinGer & "\" & oSpecialName
CAIType = "C2"
Download_File 0, oPIC, StrSave & "\1.jpg", True, document.getElementById("SpecialURL").value, StrCookie
MusicBody = IStr.RegContent(StrBody,"<form name=form2 target=myplay action=../rd18playlist.htm>","<input name=""chkall2"" onclick=CheckAll(this.form) type=""button"" value=""全 選"" />")
MusicNameArr = IStr.RegContent(MusicBody,"<a href=""../mydown.htm?musicname=",""" target=_blank>",0,True)
MusicNameArr = Split(MusicNameArr,"§")
MusicURLArr = IStr.RegContent(MusicBody,"<input name=""checked"" type=""checkbox"" value=""",""" />",0,True)
MusicURLArr = Split(MusicURLArr,"§")
MusicCount = UBound(MusicURLArr)
CAIType = "C3"
MusicPtr = 0
GetMusic
Case "C3"
StrBody = FDown.Body
MusicURL = "http://wma7.520music.com/20060312/" & IStr.RegContent(StrBody,"document.write(""<PARAM NAME=\""URL\"" VALUE='""+url+""/","'>"")")
MusicSave = StrSave & "\" & MusicPtr+1 & IStr.GetFileExt(MusicURL)
CAIType = ""
StrCookie = Download_Text(0,"http://hi.520music.com/hi.htm", "gb2312", True, MusicPlayer, "")
StrCookie = FDown.Body
StrCookie = IStr.RegContent(StrCookie,"document.cookie=""","; domain=hi.520music.com;")
'MsgBox StrCookie
CAIType = "C4"
Download_File 0, MusicURL, MusicSave, False, document.getElementById("SpecialURL").value, StrCookie
Case "C4"
CAIType = "C3"
MusicPtr = MusicPtr + 1
GetMusic
End Select
If blnDStop = True Then
FDown.bStop
Exit Sub
End If
End Sub
相關(guān)文章
PostHttpPage用asp是實現(xiàn)模擬登錄效果的代碼
PostHttpPage用asp是實現(xiàn)模擬登錄效果的代碼...2007-09-09asp下取得客戶端IP地址函數(shù) 轉(zhuǎn)換IP地址函數(shù)
asp下取得客戶端IP地址函數(shù) 轉(zhuǎn)換IP地址函數(shù)...2007-08-08asp實現(xiàn)批量插入表單中的數(shù)據(jù)到數(shù)據(jù)庫的方法
asp實現(xiàn)批量插入表單中的數(shù)據(jù)到數(shù)據(jù)庫的方法...2007-08-08ASP中只有UrlEncode,沒有Urldecode問題的解決方法?
這篇文章主要介紹了ASP中只有UrlEncode,沒有Urldecode問題的解決方法? ,需要的朋友可以參考下2015-05-05