迅雷官網(wǎng)為了防采集在URL中加的變量

2010-08-28 10:50:18來源:西部e網(wǎng)作者:

采集迅雷官網(wǎng)代碼:
------------------------
如電影“寶貝計劃”的查看頁面如下:
http://wstatic.xunlei.com/web/content.htm?cid=388EB545E0D78A33D8428A5CC2811A78E94114B7
而內(nèi)容介紹與迅雷下載地址卻藏在下面這個頁面:http://rstatic.xunlei.com/resource_data/56/142/388EB545E0D78A33D8428A5CC2811A78E94114B7.htm
(用瀏覽器打開是空白的,請查看該頁的源代碼,內(nèi)容就在源代碼里)

迅雷官網(wǎng)為了防采集在URL中加了2個變量(這里是56、142),下面代碼就為你算出該變量內(nèi)容。

'------------------------------------------------------------

Public Function Dec(Hex)
Dim i
Dim B
For i = 1 To Len(Hex)
Select Case Mid(Hex, Len(Hex) - i + 1, 1)
Case "0": B = B + 16 ^ (i - 1) * 0
Case "1": B = B + 16 ^ (i - 1) * 1
Case "2": B = B + 16 ^ (i - 1) * 2
Case "3": B = B + 16 ^ (i - 1) * 3
Case "4": B = B + 16 ^ (i - 1) * 4
Case "5": B = B + 16 ^ (i - 1) * 5
Case "6": B = B + 16 ^ (i - 1) * 6
Case "7": B = B + 16 ^ (i - 1) * 7
Case "8": B = B + 16 ^ (i - 1) * 8
Case "9": B = B + 16 ^ (i - 1) * 9
Case "A": B = B + 16 ^ (i - 1) * 10
Case "B": B = B + 16 ^ (i - 1) * 11
Case "C": B = B + 16 ^ (i - 1) * 12
Case "D": B = B + 16 ^ (i - 1) * 13
Case "E": B = B + 16 ^ (i - 1) * 14
Case "F": B = B + 16 ^ (i - 1) * 15
End Select
Next
Dec = B
End Function

cid="388EB545E0D78A33D8428A5CC2811A78E94114B7"   '該CID只是電影寶貝計劃的CID,其他電影查看其URL
iParentDir = Dec(left(cid,2))
iChildDir = Dec(mid(cid,3,2))
Url="

'------------------------------------------------
得到的 Url 就是藏著電影內(nèi)容與下載地址的網(wǎng)頁地址,然后你用采集程序批量采集即可。