您好,登錄后才能下訂單哦!
小編給大家分享一下如何使用hta提取網易文件,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
<TITLE>網易文件攝取</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<HTA:APPLICATION
ID="MyhyliApp"
APPLICATIONNAME="設置程序"
VERSION="1.0"
SCROLL="no"
INNERBORDER="no"
CONTEXTMENU="no"
CAPTION="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal"
NAVIGABLE="yes"
/>
<style type="text/css">
<!--
.TT1 { font-family: "隸書";
font-size: 24px;
font-weight: bold;
}
.title {
}
.info {
font-family: "隸書";
font-size: 16px;
color: #FF0000;
font-weight: bold;
}
.separator { width:100%;
margin:2px;
margin-top:-4px;
height:12px;
overflow:hidden;
}
.list { height: 80px;
width: 100%;
background-color: #E3EFF9;
}
.s_button {
background-color: #FFCC99;
position: static;
text-align: center;
vertical-align: middle;
padding: 1px;
color: #0033CC;
border: 1px solid #996633;
width: 100%;
}
.grid1 {
font-family: "隸書";
font-size: 16px;
background-color: #006699;
background-position: center center;
text-align: center;
vertical-align: middle;
height: 100%;
width: 100%;
color: #00FF99;
}
.grid2 {
font-family: "宋體";
text-align: left;
vertical-align: middle;
height: 100%;
width: 100%;
font-size: 12px;
}
.grid3 {
text-align: center;
vertical-align: middle;
height: 100%;
width: 100%;
}
.preview {
position:absolute;
width:140px;
height:140px;
z-index:1;
left: 301px;
top: 61px;
overflow: visible;
border-top-color: #FF0000;
border-right-color: #FF0000;
border-bottom-color: #FF0000;
border-left-color: #FF0000;
background-color: #FF9966;
margin: 1px;
padding: 1px;
visibility: hidden;
}
.STYLE2 {
color: #00FF00;
font-weight: bold;
font-family: "隸書";
font-size: 14px;
}
-->
</style>
<div class="separator">
<hr>
</div>
<table width="100%" height="4%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" align="center" valign="middle" id=menubar onselectstart="return false"><span class="TT1" id="consume">網易圖片文件一覽表</span> </td>
</tr>
</table>
<div class="separator">
<hr>
</div>
<table width="100%" height="415" border="1">
<tr>
<td width="81%" height="16" rowspan="8" valign="top" bgcolor="#FFFFFF" ><div class="info" id=list ></div></td>
<td height="16" colspan="2" align="center" valign="middle" bordercolor="#FF0000" bgcolor="#000080" ><div class="preview" id="preview">
<p> </p>
</div>
<span class="STYLE2"> 信息公布</span></td>
</tr>
<tr>
<td height="182" colspan="2" align="left" valign="top" bgcolor="#FFFFFF" class="info" ><div class="info" id="infotext" >
<p>本程序可以自由下載網易圖片..</p>
<p> </p>
</div></td>
</tr>
<tr>
<td height="33" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF" class="info" ><input name="add" type="submit" class="s_button" id="add" onclick="show()" value="取文件信息" /></td>
</tr>
<tr>
<td height="33" align="center" valign="middle" bgcolor="#FFFFFF" ><select name="Atype" id="Atype" onchange="changevalue()">
<option value="jpg">彩圖</option>
<option value="gif">動畫</option>
</select></td>
<td height="33" align="center" valign="middle" bgcolor="#FFFFFF" ><select name="imagetype" id="imagetype">
<option selected="selected">圖片類型</option>
<option>全部</option>
<option value="90">絕色風光</option>
<option value="91">四季花語 </option>
<option value="89">海底世界 </option>
<option value="34">絕色美女 </option>
<option value="198">都市麗人</option>
<option value="200">手繪美女</option>
</select></td>
</tr>
<tr>
<td height="33" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF" ><input name="del2" type="submit" class="s_button" id="del2" onclick="downloadfile()" value="下載選定項" /></td>
</tr>
<tr>
<td height="33" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF" ><input name="del" type="submit" class="s_button" id="del" onclick="tb_del()" value="刪除選定項" /></td>
</tr>
<tr>
<td width="5%" height="25" align="center" valign="middle" bgcolor="#000080" class="STYLE2" >從 </td>
<td width="14%" bgcolor="#FFFFFF" valign="middle" align="center" ><a title="在此處輸入起始頁數">
<input name="start1" type="text" id="start1" value="1" size="10" />
</a></td>
</tr>
<tr>
<td height="26" align="center" valign="middle" bgcolor="#000080" class="STYLE2" >到</td>
<td height="26" align="center" valign="middle" bgcolor="#FFFFFF" ><a title="在此處輸入結束頁數">
<input name="start2" type="text" id="start2" size="10" value="1"/>
</a></td>
</tr>
</table>
<script language="vbscript">
Public fileext
str1 = "<tr><td><span class='grid1'><input type=checkbox id='sall' onclick='selectall()'>全都選</span></td>"
str1 = str1& "<td><span class='grid1'>預覽</span></td>"
str1 = str1 & "<td><span class='grid1'>文件路徑</span></td>"
str1 = str1 & "<td><span class='grid1'>文件名稱</span></td></tr>"
Sub Window_onLoad
window.resizeTo 750, 515
ileft = (window.screen.Width -750) / 2
itop = (window.screen.height -515) / 2
window.moveTo ileft, itop
End Sub
Function connect(num)
Dim imageinfo, Length
fileext = Atype.options(Atype.selectedindex).Value
imgtype = imagetype.options(imagetype.selectedindex).Value
imgtypenum = Atype.selectedindex
url = "http://mms.163.com/new_web/cm_lv2_pic.jsp?catID="&imgtype&"&ord=dDate&page="&num&"&type="&imgtypenum&"&key="
imageurl = "http://mmsimg.163.com/new_web/loaditem.jsp/type="&imgtypenum&"/path="
Set http = CreateObject("Microsoft.XMLHTTP")
http.Open "GET", url, False
http.send
vIn = http.ResponseBody
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt (NextCharCode))
i = i + 1
End If
Next
'------獲取文件的地址------------'
Do
pos = InStr(strReturn, "showPic")
pos1 = InStr(strReturn, "128x128")
If pos>0 Then
Length = pos1 - pos
imageinfo = Mid(strReturn, pos, Length)
images = Split(imageinfo, ",")
imagepath = Mid(images(2), 2, Len(images(2)) -1)&"128x128."& fileext
'----------獲取文件的名字------------'
namepos = InStr(strReturn, "\n名字:")
namepos1 = InStr(strReturn, "\n人氣")
namelength = namepos1 - namepos
imagename = Mid(Mid(strReturn, namepos, namelength), 6)
strHTML = strHTML & "<tr><td><span class='grid2'><input id=addme type=checkbox>選定</span></td>"
strHTML = strHTML &"<td><span class='grid3'><a onMousemove='view()' onmouseout='hideview()' href=#><img onClick='addpro()' src='"&imageurl&imagepath&"' width=30 height=20></a></span></td>"
strHTML = strHTML & "<td><span class='grid2'>" & imagepath & "</span></td>"
strHTML = strHTML & "<td><span class='grid2'>" & imagename & "</span></td></tr>"
strReturn = Mid(strReturn, namepos1 + 20)
Else
Exit Do
End If
Loop
connect = strHTML
End Function
Function writeinner()
For i = start1.Value To start2.Value
strHTML = strHTML & connect(i)
Next
strHTML = "<table id='mytable' width=100% border=1 bordercolor=green>" &str1&strHTML& "</table>"
list.innerHTML = strHTML
infotext.innertext = infotext.innertext & "連接成功。"
infotext.innertext = infotext.innertext & vbCrLf &vbCrLf & "從第" & start1.Value & "頁到第" & start2.Value & "頁的gif圖片文件信息!"
End Function
Function show()
If Not (IsNumeric(start2.Value)) Or Not (IsNumeric(start2.Value)) Then
infotext.innertext = infotext.innertext & vbCrLf & "配置錯誤..."
Else
infotext.innertext = "正在連接..."
window.settimeout "writeinner()", 200
End If
End Function
Sub view()
strHTML1 = "<img src='" &window.event.srcElement.src &"' width='140' height='140'>"
preview.runtimeStyle.pixelLeft = window.event.x + 5
preview.runtimeStyle.pixelTop = window.event.y + 5
preview.style.visibility = "visible"
preview.innerHTML = strHTML1
End Sub
Sub hideview()
preview.style.visibility = "hidden"
End Sub
Sub addpro()
Set obj = window.event.srcElement.parentelement.parentelement.parentelement.parentelement
If obj.cells(0).children(0).children(0).checked = false Then
obj.cells(0).children(0).children(0).checked = true
Else
obj.cells(0).children(0).children(0).checked = false
End If
End Sub
Sub tb_del()
Set obj = document.all.namedItem("mytable")
If obj.rows.Length>2 Then
Set tagID = document.all.namedItem("addme") '獲取對象ID:delcheck'
For Each otag in tagID
If otag.checked Then
objrow = otag.parentelement.parentelement.parentelement.rowindex '獲取對象的行序數;'
obj.deleteRow(objrow) '刪除該項;'
End If
Next
Else
MsgBox "才一項你都刪,哪有這樣的?!", 0, "刪除提醒"
Exit Sub
End If
End Sub
Sub selectall()
Set obj = document.all.namedItem("mytable")
Set objcheck = document.all.namedItem("sall")
Set tagID = document.all.namedItem("addme") '獲取對象ID:addme'
For Each otag in tagID
otag.checked = objcheck.checked
Next
End Sub
Sub download()
Set fso = CreateObject("Scripting.FileSystemObject")
If Not (fso.FolderExists("★網易下載圖片★")) Then
fso.CreateFolder("★網易下載圖片★")
End If
Set http = CreateObject("Microsoft.XMLHTTP")
Set obj = document.all.namedItem("mytable")
Set tagID = document.all.namedItem("addme") '獲取對象ID:delcheck'
For Each otag in tagID
If otag.checked Then
Set objrow = otag.parentelement.parentelement.parentelement '獲取對象的行;'
downurl = objrow.cells(1).children(0).children(0).children(0).src
filename = objrow.cells(3).children(0).innertext
http.Open "GET", downurl, False
http.send
Set aso = CreateObject("ADODB.Stream")
aso.Type = 1
aso.Open
aso.Write http.ResponseBody
aso.savetofile "★網易下載圖片★\" & filename & "."&fileext, 2
aso.Close
End If
Next
infotext.innertext = infotext.innertext & vbCrLf & "文件下載成功。"
infotext.innertext = infotext.innertext & vbCrLf & "文件保存在:" & vbCrLf &"“★網易下載圖片★”下"
End Sub
Sub downloadfile()
infotext.innertext = "正在下載文件...." '"
window.settimeout "download()", 200
End Sub
Sub changevalue()
AID = Array("130", "112", "67", "14", "122", "158")
PID = Array("90", "91", "89", "34", "198", "200")
If Atype.selectedindex = 0 Then
For i = 0 To 5
imagetype.options(i + 2).Value = PID(i)
Next
Else
For i = 0 To 5
imagetype.options(i + 2).Value = AID(i)
Next
End If
End Sub
</script>
看完了這篇文章,相信你對“如何使用hta提取網易文件”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。