|
  
|
1#
发表于 2007-5-2 01:13 PM
| 只看该作者
本软件可以批量下载指定相册里的所有图片
By 一点笔记-
- #include <GuiConstants.au3>
- $version = "v1.01"
- $aboutwin = GuiCreate("关于", 220, 95,-1, -1,-1)
- GuiCtrlCreateLabel("版本: " & $version, 5, 5, 95, 15)
- GuiCtrlCreateLabel("E-mail: ", 5, 20, 40, 15)
- GuiCtrlCreateLabel("zcbenz@gmail.com", 46, 20, 100, 15,$SS_NOTIFY)
- GuiCtrlCreateLabel("Blog: ", 5, 35, 40, 15)
- $Label_03 = GuiCtrlCreateLabel("http://my.opera.com/z8519312", 35,35, 170, 15,$SS_NOTIFY)
- GUICtrlSetColor($Label_03,0x0000ff)
- GUICtrlSetCursor(-1, 0)
- $CheckNew = GuiCtrlCreateButton("检查更新", 5, 55, 102, 35)
- $aboutwinClose = GuiCtrlCreateButton("关闭", 112, 55, 102, 35)
- GuiSetState(@SW_HIDE)
- $main = GuiCreate("相册下载器", 400, 245,-1, -1)
- $tab=GUICtrlCreateTab (5,5, 390,63)
- $162=GUICtrlCreateTabitem ("网易相册")
- GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
- $2Label_2 = GuiCtrlCreateLabel("http://photo.163.com/photos/", 10, 46, 170, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $2Input_3 = GuiCtrlCreateInput("", 182, 42, 65, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $2Label_4 = GuiCtrlCreateLabel("/", 250, 46, 5, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $2Input_5 = GuiCtrlCreateInput("", 260, 42, 65, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $opera=GUICtrlCreateTabitem ("Opera相册")
- GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
- $Label_2 = GuiCtrlCreateLabel("http://my.opera.com/", 10, 46, 118, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $Input_3 = GuiCtrlCreateInput("", 136, 42, 58, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $Label_4 = GuiCtrlCreateLabel("/albums/show.dml?id=", 197, 46, 140, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $Input_5 = GuiCtrlCreateInput("", 320, 42, 65, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $webshots=GUICtrlCreateTabitem ("Webshots相册")
- GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
- $1Label_2 = GuiCtrlCreateLabel("http://", 10, 46, 40, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $1Input_3 = GuiCtrlCreateInput("", 54, 44, 85, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $1Label_4 = GuiCtrlCreateLabel(".webshots.com/album/", 145, 46, 120, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $1Input_5 = GuiCtrlCreateInput("", 269, 44, 110, 18)
- GUICtrlSetColor(-1,0x0000ff)
- $feeds=GUICtrlCreateTabitem ("通过Feed下载")
- GuiCtrlCreateLabel("请输入RSS地址:", 10, 30, 90, 18)
- $3Input = GuiCtrlCreateInput("", 10, 42, 350, 18)
- GUICtrlSetColor(-1,0x0000ff)
- GUICtrlCreateTabitem ("")
- $Label_6 = GuiCtrlCreateLabel("请选择保存地址:", 10, 72, 360, 20)
- $pathdsa = GuiCtrlCreateInput("", 10, 88, 340, 20)
- $brower = GuiCtrlCreateButton("浏览", 355, 88, 35, 20)
- $Button_9 = GuiCtrlCreateButton("开始下载", 10, 120, 80, 35)
- $about = GuiCtrlCreateButton("关于", 10, 160, 80, 35)
- $cancel = GuiCtrlCreateButton("退出", 10, 200, 80, 35)
- $Label_7 = GuiCtrlCreateLabel("状态:", 100, 120, 70, 18)
- $loading = GUICtrlCreateEdit ("", 100 , 138 ,150,94,$ES_AUTOVSCROLL+$ES_READONLY)
- $Label_8 = GuiCtrlCreateLabel("图片预览:", 269, 120, 100, 18)
- $pic = GUICtrlCreatePic("",269 ,138, 121,94)
- GuiSetState()
- While 1
-
- $path = GUICtrlRead ($pathdsa)
- $exist = FileExists ($path)
- $username = GUICtrlRead ($Input_3)
- $id = GUICtrlRead ($Input_5)
-
- Dim $num
- Dim $word
- ;分析webshots相册地址
- $toto = StringSplit (GUICtrlRead ($1Input_5), "")
- Dim $old
- If $old <> GUICtrlRead ($1Input_5) Then
- For $q = 1 to UBound($toto) -1 Step 1
- $111 = $num
- $222 = $word
- If StringIsDigit ($toto[$q]) = 1 Then
- $num = $111 & $toto[$q]
- ElseIf StringIsAlpha ($toto[$q]) =1 Then
- $word = $222 & $toto[$q]
- EndIf
- Next
- $old = GUICtrlRead ($1Input_5)
- EndIf
- ;得到feed地址
- $operaurl = "http://my.opera.com/" & GUICtrlRead ($Input_3) & "/xml/rss/photocast/" & GUICtrlRead ($Input_5)
- $wbshotsurl = "http://community.webshots.com/slideshow?ID=" & $num & "&key=" & $word
- $163url = "http://163.zpoo.com/sydownphoto.php?user=" & GUICtrlRead ($2Input_3) & "&aid=" & GUICtrlRead ($2Input_5)
- $feedurl = GUICtrlRead ($3Input)
- $msg = GuiGetMsg(1)
-
- Select
- Case $msg[0] = $cancel
- Exit
- Case $msg[0] = $Label_03
- RunWait(@ComSpec & " /c " & "start http://my.opera.com/z8519312", "", @SW_HIDE )
- Case $msg[0] = $CheckNew
- CheckNew()
- Case $msg[0] = $aboutwinClose
- GuiSetState(@SW_HIDE , $aboutwin)
- ContinueLoop
- Case $msg[0] = $GUI_EVENT_CLOSE
- If $msg[1] = $aboutwin Then
- GuiSetState(@SW_HIDE , $aboutwin)
- ElseIf $msg[1] = $main Then
- Exit
- EndIf
- Case $msg[0] = $brower
- $d2 = FileSelectFolder("请选择一个文件夹:", "",1)
- GUICtrlSetData($pathdsa, $d2)
- Case $msg[0] = $Button_9
- wincontrol(1)
- ;判断是否填写完整
- If GUICtrlRead($tab) = 1 Then
- If $username = "" Or $id = "" Then
- GUICtrlSetData ($loading, "请填写完整" & @CRLF)
- wincontrol(2)
- ContinueLoop
- EndIf
- ElseIf GUICtrlRead($tab) = 2 Then
- if GUICtrlRead ($1Input_5) = "" Or GUICtrlRead ($1Input_3) = "" Then
- GUICtrlSetData ($loading, "请填写完整" & @CRLF ,1)
- wincontrol(2)
- ContinueLoop
- EndIf
- ElseIf GUICtrlRead($tab) = 0 Then
- if GUICtrlRead ($2Input_5) = "" Or GUICtrlRead ($2Input_3) = "" Then
- GUICtrlSetData ($loading, "请填写完整" & @CRLF ,1)
- wincontrol(2)
- ContinueLoop
- EndIf
- EndIf
- If $exist = 0 Then
- GUICtrlSetData ($loading, "文件夹不存在" & @CRLF,1)
- wincontrol(2)
- ContinueLoop
- EndIf
- ;下载feed
- GUICtrlSetData ($loading, "开始获取图片列表..." & @CRLF )
- If GUICtrlRead($tab) = 0 Then ;网易相册
- $checkexist = InetGet ( $163url, "163.tem",1,1)
- $filesize = InetGetSize ($163url)
- Do
- Sleep(500)
- GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF )
- Until @InetGetActive = 0
- If $checkexist = 0 Or FileGetSize("163.tem") = "0" Then
- GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
- wincontrol(2)
- ContinueLoop
- Else
- GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
- $2picall = StringStripCR(FileRead("163.tem"))
- If StringInStr ($2picall,"此目录为空,或已加密") <> 0 Then
- GUICtrlSetData ($loading, "此相册为空,或已加密")
- wincontrol(2)
- ContinueLoop
- EndIf
- neteasepic()
- EndIf
- ElseIf GUICtrlRead($tab) = 1 Then ;opera相册
- $checkexist = InetGet ( $operaurl, "op.tem",1,1)
- $filesize = InetGetSize ($operaurl)
- Do
- Sleep(500)
- GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
- Until @InetGetActive = 0
- If $checkexist = 0 Or FileGetSize("op.tem") = "0" Then
- GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
- wincontrol(2)
- ContinueLoop
- Else
- GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
- operapic()
- EndIf
- ElseIf GUICtrlRead($tab) = 2 Then ;webshots相册
- $checkexist = InetGet ( $wbshotsurl, "wb.tem",1,1)
- $filesize = InetGetSize ( $wbshotsurl)
- Do
- Sleep(500)
- GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
- Until @InetGetActive = 0
- If $checkexist = 0 Or FileGetSize("wb.tem") = "0" Then
- GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
- wincontrol(2)
- ContinueLoop
- Else
- GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
- wbpic()
- EndIf
- ElseIf GUICtrlRead($tab) = 3 Then ;Feeds
- $checkexist = InetGet ( $feedurl, "rss.tem",1,1)
- $filesize = InetGetSize ( $feedurl)
- Do
- Sleep(500)
- GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
- Until @InetGetActive = 0
- If $checkexist = 0 Or FileGetSize("op.tem") = "0" Then
- GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
- wincontrol(2)
- ContinueLoop
- Else
- $DownloadFileContent = StringStripCR(FileRead("op.tem"))
- If StringInStr ($DownloadFileContent,"<rss") = 0 Then
- GUICtrlSetData ($loading, "该地址不是有效的Feed")
- wincontrol(2)
- ContinueLoop
- EndIf
- GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
- operapic()
- EndIf
- EndIf
- GUICtrlSetData ($loading, "下载完毕!" ,1)
- MsgBox(0,"OK","下载完毕!")
- FileDelete("*.tem")
- wincontrol(2)
- ContinueLoop
- Case $msg[0] = $about
- GuiSetState(@SW_SHOW , $aboutwin)
- Case Else
- ;;;
- EndSelect
- WEnd
- Func neteasepic()
- $temp2 = _StringBetween($2picall, "<br><font color=red>" ,"<font color=red>")
- $temp2_1 = StringSplit(StringStripWS($temp2[0],8), "[")
- $2picaddress = $temp2_1[1]
- $2pica = _StringBetween($2picall, "target=_blank><font color=blue>" ,"</font></a>")
- For $i = 0 to UBound($2pica) -1 Step 1
- $2picnameget = StringSplit($2pica[$i] ,"/")
- $2picname = $2picnameget[$2picnameget[0]]
- InetGet ($2pica[$i] , $path & "\" & $2picname,0,1)
- $2size = InetGetSize ($2pica[$i])
- Do
- Sleep(500)
- GUICtrlSetData ($loading, "相册名:" & $2picaddress & @CRLF & "正在下载:" & $2picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $2size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($2pica) - $i -1 & @CRLF)
- Until @InetGetActive = 0
- GUICtrlSetImage ($pic, $path & "\" & $2picname)
- Next
- EndFunc
- Func operapic()
- $picall = StringStripCR(FileRead("op.tem"))
- $picaddress = _StringBetween($picall, "<title>" ,"</title>")
- $pica = _StringBetween($picall, "img src=""" ,"""")
- For $i = 0 to UBound($pica) -1 Step 1
- $picnameget = StringSplit($pica[$i] ,"/")
- $picname = $picnameget[$picnameget[0]]
- InetGet ($pica[$i] , $path & "\" & $picname,0,1)
- $size = InetGetSize ($pica[$i])
- Do
- Sleep(500)
- GUICtrlSetData ($loading, "相册名:" & $picaddress[0] & @CRLF & "正在下载:" & $picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($pica) - $i -1 & @CRLF)
- Until @InetGetActive = 0
- GUICtrlSetImage ($pic, $path & "\" & $picname)
- Next
- EndFunc
- Func wbpic()
- $1picall = StringStripCR(FileRead("wb.tem"))
- $temp1 = _StringBetween($1picall, "<title>" ,"</title>")
- $1picaddress = StringTrimLeft (StringStripWS($temp1[0],8) ,29)
- $1pica = _StringBetween($1picall, "['" ,"'")
- For $i = 0 to UBound($1pica) -1 Step 1
- $1picnameget = StringSplit($1pica[$i] ,"/")
- $1picname = $1picnameget[$1picnameget[0]]
- InetGet ($1pica[$i] , $path & "\" & $1picname,0,1)
- $1size = InetGetSize ($1pica[$i])
- Do
- Sleep(500)
- GUICtrlSetData ($loading, "相册名:" & $1picaddress & @CRLF & "正在下载:" & $1picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $1size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($1pica) - $i -1 & @CRLF)
- Until @InetGetActive = 0
- GUICtrlSetImage ($pic, $path & "\" & $1picname)
- Next
- EndFunc
- Func CheckNew()
- $CheckNewCompelete = InetGet ( "http://files.myopera.com/z8519312/files/ver.txt", "ver.tem",1,0)
- If $CheckNewCompelete = 0 Then
- MsgBox(0,"错误","网络连接失败")
- Else
- $NewVersion = FileReadLine ( "ver.tem" ,1)
- $DownloadLink = FileReadLine ( "ver.tem" ,2)
- FileDelete("*.tem")
- If $NewVersion = $version Then
- MsgBox(0,"","当前版本已经是新版本")
- WinActivate ("关于")
- Else
- $DownloadOrNot = MsgBox(4,"","已有更新版本,版本号为" & $NewVersion & ".是否更新?")
- If $DownloadOrNot = 6 Then
- RunWait(@ComSpec & " /c " & "start " & $DownloadLink & """", "", @SW_HIDE )
- Else
- ;;
- EndIf
- EndIf
- EndIf
- EndFunc
- Func wincontrol($number)
- If $number = 1 Then
- GUICtrlSetState($Button_9,$GUI_DISABLE)
- GUICtrlSetState($about,$GUI_DISABLE)
- GUICtrlSetState($cancel,$GUI_DISABLE)
- GUICtrlSetState($tab,$GUI_DISABLE)
- ElseIf $number = 2 Then
- GUICtrlSetState($Button_9,$GUI_ENABLE)
- GUICtrlSetState($about,$GUI_ENABLE)
- GUICtrlSetState($cancel,$GUI_ENABLE)
- GUICtrlSetState($tab,$GUI_ENABLE)
- FileDelete("*.tem")
- EndIf
- EndFunc
- Func _StringBetween($sString, $sStart, $sEnd, $vCase = -1, $iSRE = -1)
- If $iSRE = -1 Or $iSRE = Default Then
- If $vCase = -1 Or $vCase = Default Then $vCase = 0
- If $vCase <> -1 And $vCase <> Default Then $vCase = 1
- Local $sHold = '', $sSnSStart = '', $sSnSEnd = ''
- While StringLen($sString) > 0
- $sSnSStart = StringInStr($sString, $sStart, $vCase)
- If Not $sSnSStart Then ExitLoop
- $sString = StringTrimLeft($sString, ($sSnSStart + StringLen($sStart)) - 1)
- $sSnSEnd = StringInStr($sString, $sEnd, $vCase)
- If Not $sSnSEnd Then ExitLoop
- $sHold &= StringLeft($sString, $sSnSEnd - 1) & Chr(1)
- $sString = StringTrimLeft($sString, $sSnSEnd)
- WEnd
- If Not $sHold Then Return SetError(1, 0, 0)
- $sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1))
- Local $aArray[UBound($sHold) - 1]
- For $iCC = 1 To UBound($sHold) - 1
- $aArray[$iCC - 1] = $sHold[$iCC]
- Next
- Return $aArray
- Else
- If $vCase = Default Or $vCase = -1 Then $vCase = '(?i)'
- If $vCase <> Default And $vCase <> -1 Then $vCase = ''
- Local $aArray = StringRegExp($sString, '(?s)' & $vCase & $sStart & '(.*?)' & $sEnd, 3)
- If IsArray($aArray) Then Return $aArray
- Return SetError(1, 0, 0)
- EndIf
- EndFunc
复制代码 |
感谢Baidu,Google,Dreams8给我这次机会!
还要感谢我的爸爸妈妈!
HOHO |
|