返回列表 回复 发帖

相册下载器v1.01 AU3源码

本软件可以批量下载指定相册里的所有图片
By 一点笔记

  1. #include <GuiConstants.au3>
  2. $version = "v1.01"
  3. $aboutwin = GuiCreate("关于", 220, 95,-1, -1,-1)
  4. GuiCtrlCreateLabel("版本: " & $version, 5, 5, 95, 15)
  5. GuiCtrlCreateLabel("E-mail: ", 5, 20, 40, 15)
  6. GuiCtrlCreateLabel("zcbenz@gmail.com", 46, 20, 100, 15,$SS_NOTIFY)
  7. GuiCtrlCreateLabel("Blog: ", 5, 35, 40, 15)
  8. $Label_03 = GuiCtrlCreateLabel("http://my.opera.com/z8519312", 35,35, 170, 15,$SS_NOTIFY)
  9. GUICtrlSetColor($Label_03,0x0000ff)
  10. GUICtrlSetCursor(-1, 0)
  11. $CheckNew = GuiCtrlCreateButton("检查更新", 5, 55, 102, 35)
  12. $aboutwinClose = GuiCtrlCreateButton("关闭", 112, 55, 102, 35)
  13. GuiSetState(@SW_HIDE)
  14. $main = GuiCreate("相册下载器", 400, 245,-1, -1)
  15. $tab=GUICtrlCreateTab (5,5, 390,63)
  16. $162=GUICtrlCreateTabitem ("网易相册")
  17. GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
  18. $2Label_2 = GuiCtrlCreateLabel("http://photo.163.com/photos/", 10, 46, 170, 18)
  19. GUICtrlSetColor(-1,0x0000ff)
  20. $2Input_3 = GuiCtrlCreateInput("", 182, 42, 65, 18)
  21. GUICtrlSetColor(-1,0x0000ff)
  22. $2Label_4 = GuiCtrlCreateLabel("/", 250, 46, 5, 18)
  23. GUICtrlSetColor(-1,0x0000ff)
  24. $2Input_5 = GuiCtrlCreateInput("", 260, 42, 65, 18)
  25. GUICtrlSetColor(-1,0x0000ff)
  26. $opera=GUICtrlCreateTabitem ("Opera相册")
  27. GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
  28. $Label_2 = GuiCtrlCreateLabel("http://my.opera.com/", 10, 46, 118, 18)
  29. GUICtrlSetColor(-1,0x0000ff)
  30. $Input_3 = GuiCtrlCreateInput("", 136, 42, 58, 18)
  31. GUICtrlSetColor(-1,0x0000ff)
  32. $Label_4 = GuiCtrlCreateLabel("/albums/show.dml?id=", 197, 46, 140, 18)
  33. GUICtrlSetColor(-1,0x0000ff)
  34. $Input_5 = GuiCtrlCreateInput("", 320, 42, 65, 18)
  35. GUICtrlSetColor(-1,0x0000ff)
  36. $webshots=GUICtrlCreateTabitem ("Webshots相册")
  37. GuiCtrlCreateLabel("请输入相册URL:", 10, 30, 90, 18)
  38. $1Label_2 = GuiCtrlCreateLabel("http://", 10, 46, 40, 18)
  39. GUICtrlSetColor(-1,0x0000ff)
  40. $1Input_3 = GuiCtrlCreateInput("", 54, 44, 85, 18)
  41. GUICtrlSetColor(-1,0x0000ff)
  42. $1Label_4 = GuiCtrlCreateLabel(".webshots.com/album/", 145, 46, 120, 18)
  43. GUICtrlSetColor(-1,0x0000ff)
  44. $1Input_5 = GuiCtrlCreateInput("", 269, 44, 110, 18)
  45. GUICtrlSetColor(-1,0x0000ff)
  46. $feeds=GUICtrlCreateTabitem ("通过Feed下载")
  47. GuiCtrlCreateLabel("请输入RSS地址:", 10, 30, 90, 18)
  48. $3Input = GuiCtrlCreateInput("", 10, 42, 350, 18)
  49. GUICtrlSetColor(-1,0x0000ff)
  50. GUICtrlCreateTabitem ("")  
  51. $Label_6 = GuiCtrlCreateLabel("请选择保存地址:", 10, 72, 360, 20)
  52. $pathdsa = GuiCtrlCreateInput("", 10, 88, 340, 20)
  53. $brower = GuiCtrlCreateButton("浏览", 355, 88, 35, 20)
  54. $Button_9 = GuiCtrlCreateButton("开始下载", 10, 120, 80, 35)
  55. $about = GuiCtrlCreateButton("关于", 10, 160, 80, 35)
  56. $cancel = GuiCtrlCreateButton("退出", 10, 200, 80, 35)
  57. $Label_7 = GuiCtrlCreateLabel("状态:", 100, 120, 70, 18)
  58. $loading = GUICtrlCreateEdit ("", 100 , 138 ,150,94,$ES_AUTOVSCROLL+$ES_READONLY)
  59. $Label_8 = GuiCtrlCreateLabel("图片预览:", 269, 120, 100, 18)
  60. $pic = GUICtrlCreatePic("",269 ,138, 121,94)
  61. GuiSetState()
  62. While 1

  63. $path = GUICtrlRead ($pathdsa)
  64. $exist = FileExists ($path)
  65. $username = GUICtrlRead ($Input_3)
  66. $id = GUICtrlRead ($Input_5)

  67. Dim $num
  68. Dim $word
  69. ;分析webshots相册地址
  70. $toto = StringSplit (GUICtrlRead ($1Input_5), "")
  71. Dim $old
  72. If $old <> GUICtrlRead ($1Input_5) Then
  73.   For $q = 1 to UBound($toto) -1 Step 1
  74.    $111 = $num
  75.    $222 = $word
  76.    If StringIsDigit ($toto[$q]) = 1 Then
  77.     $num = $111 & $toto[$q]
  78.    ElseIf StringIsAlpha ($toto[$q]) =1 Then
  79.     $word = $222 & $toto[$q]
  80.    EndIf
  81.   Next
  82.   $old = GUICtrlRead ($1Input_5)
  83. EndIf
  84. ;得到feed地址
  85. $operaurl = "http://my.opera.com/" & GUICtrlRead ($Input_3) & "/xml/rss/photocast/" & GUICtrlRead ($Input_5)
  86. $wbshotsurl = "http://community.webshots.com/slideshow?ID=" & $num  & "&key=" & $word
  87. $163url = "http://163.zpoo.com/sydownphoto.php?user=" & GUICtrlRead ($2Input_3) & "&aid=" & GUICtrlRead ($2Input_5)
  88. $feedurl = GUICtrlRead ($3Input)
  89. $msg = GuiGetMsg(1)

  90. Select
  91. Case $msg[0] = $cancel
  92.   Exit
  93. Case $msg[0] = $Label_03
  94.   RunWait(@ComSpec & " /c " & "start http://my.opera.com/z8519312", "", @SW_HIDE )
  95. Case $msg[0] = $CheckNew
  96.   CheckNew()
  97. Case $msg[0] = $aboutwinClose
  98.   GuiSetState(@SW_HIDE , $aboutwin)
  99.   ContinueLoop
  100. Case $msg[0] = $GUI_EVENT_CLOSE
  101.   If $msg[1] = $aboutwin Then
  102.    GuiSetState(@SW_HIDE , $aboutwin)
  103.   ElseIf $msg[1] = $main Then
  104.    Exit
  105.   EndIf
  106. Case $msg[0] = $brower
  107.   $d2 = FileSelectFolder("请选择一个文件夹:", "",1)
  108.   GUICtrlSetData($pathdsa, $d2)
  109. Case $msg[0] = $Button_9
  110.   wincontrol(1)
  111.   ;判断是否填写完整
  112.   If GUICtrlRead($tab) = 1 Then
  113.    If $username = "" Or $id = "" Then
  114.     GUICtrlSetData ($loading, "请填写完整" & @CRLF)
  115.     wincontrol(2)
  116.    ContinueLoop
  117.    EndIf
  118.   ElseIf GUICtrlRead($tab) = 2 Then
  119.    if GUICtrlRead ($1Input_5) = "" Or GUICtrlRead ($1Input_3) = "" Then
  120.     GUICtrlSetData ($loading, "请填写完整" & @CRLF ,1)
  121.     wincontrol(2)
  122.    ContinueLoop
  123.    EndIf
  124.   ElseIf GUICtrlRead($tab) = 0 Then
  125.    if GUICtrlRead ($2Input_5) = "" Or GUICtrlRead ($2Input_3) = "" Then
  126.     GUICtrlSetData ($loading, "请填写完整" & @CRLF ,1)
  127.     wincontrol(2)
  128.    ContinueLoop
  129.    EndIf
  130.   EndIf
  131.   If $exist = 0 Then
  132.    GUICtrlSetData ($loading, "文件夹不存在" & @CRLF,1)
  133.    wincontrol(2)
  134.    ContinueLoop
  135.   EndIf
  136.   ;下载feed
  137.   GUICtrlSetData ($loading, "开始获取图片列表..." & @CRLF )
  138.   If GUICtrlRead($tab) = 0 Then ;网易相册
  139.    $checkexist = InetGet ( $163url, "163.tem",1,1)
  140.    $filesize = InetGetSize ($163url)
  141.    Do
  142.    Sleep(500)
  143.    GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF )
  144.    Until @InetGetActive = 0
  145.    If $checkexist = 0 Or FileGetSize("163.tem") = "0" Then
  146.     GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
  147.     wincontrol(2)
  148.     ContinueLoop
  149.    Else
  150.     GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
  151.     $2picall = StringStripCR(FileRead("163.tem"))
  152.     If StringInStr ($2picall,"此目录为空,或已加密") <> 0 Then
  153.      GUICtrlSetData ($loading, "此相册为空,或已加密")
  154.      wincontrol(2)
  155.      ContinueLoop
  156.     EndIf
  157.     neteasepic()
  158.    EndIf
  159.   ElseIf GUICtrlRead($tab) = 1 Then ;opera相册
  160.    $checkexist = InetGet ( $operaurl, "op.tem",1,1)
  161.    $filesize = InetGetSize ($operaurl)
  162.    Do
  163.    Sleep(500)
  164.    GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
  165.    Until @InetGetActive = 0
  166.    If $checkexist = 0 Or FileGetSize("op.tem") = "0" Then
  167.     GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
  168.     wincontrol(2)
  169.     ContinueLoop
  170.    Else
  171.     GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
  172.     operapic()
  173.    EndIf
  174.   ElseIf GUICtrlRead($tab) = 2 Then ;webshots相册
  175.    $checkexist = InetGet ( $wbshotsurl, "wb.tem",1,1)
  176.    $filesize = InetGetSize ( $wbshotsurl)
  177.    Do
  178.    Sleep(500)
  179.    GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
  180.    Until @InetGetActive = 0
  181.    If $checkexist = 0 Or FileGetSize("wb.tem") = "0" Then
  182.     GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
  183.     wincontrol(2)
  184.     ContinueLoop
  185.    Else
  186.     GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
  187.     wbpic()
  188.    EndIf
  189.   ElseIf GUICtrlRead($tab) = 3 Then ;Feeds
  190.    $checkexist = InetGet ( $feedurl, "rss.tem",1,1)
  191.    $filesize = InetGetSize ( $feedurl)
  192.    Do
  193.    Sleep(500)
  194.    GUICtrlSetData ($loading,"开始获取图片列表(" & Round(@InetGetBytesRead / $filesize,2) * 100 & "%)..." & @CRLF)
  195.    Until @InetGetActive = 0
  196.    If $checkexist = 0 Or FileGetSize("op.tem") = "0" Then
  197.     GUICtrlSetData ($loading, "网络连接失败,请重试" & @CRLF)
  198.     wincontrol(2)
  199.     ContinueLoop
  200.    Else
  201.     $DownloadFileContent = StringStripCR(FileRead("op.tem"))
  202.     If StringInStr ($DownloadFileContent,"<rss") = 0 Then
  203.      GUICtrlSetData ($loading, "该地址不是有效的Feed")
  204.      wincontrol(2)
  205.      ContinueLoop
  206.     EndIf
  207.     GUICtrlSetData ($loading, "获取成功,准备开始下载图片..." & @CRLF)
  208.     operapic()
  209.    EndIf
  210.   EndIf
  211.   GUICtrlSetData ($loading, "下载完毕!" ,1)
  212.   MsgBox(0,"OK","下载完毕!")
  213.   FileDelete("*.tem")
  214.   wincontrol(2)
  215.   ContinueLoop
  216. Case $msg[0] = $about
  217.   GuiSetState(@SW_SHOW , $aboutwin)
  218. Case Else
  219.   ;;;
  220. EndSelect
  221. WEnd
  222. Func neteasepic()
  223. $temp2 = _StringBetween($2picall, "<br><font color=red>" ,"<font color=red>")
  224. $temp2_1 = StringSplit(StringStripWS($temp2[0],8), "[")
  225. $2picaddress = $temp2_1[1]
  226. $2pica = _StringBetween($2picall, "target=_blank><font color=blue>" ,"</font></a>")
  227. For $i = 0 to UBound($2pica) -1 Step 1
  228.   $2picnameget = StringSplit($2pica[$i] ,"/")
  229.   $2picname = $2picnameget[$2picnameget[0]]
  230.   InetGet ($2pica[$i] , $path & "\" & $2picname,0,1)
  231.   $2size = InetGetSize ($2pica[$i])
  232.   Do
  233.    Sleep(500)
  234.    GUICtrlSetData ($loading, "相册名:" & $2picaddress & @CRLF & "正在下载:" & $2picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $2size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($2pica) - $i -1 & @CRLF)
  235.   Until @InetGetActive = 0
  236.   GUICtrlSetImage ($pic, $path & "\" & $2picname)
  237. Next
  238. EndFunc
  239. Func operapic()
  240. $picall = StringStripCR(FileRead("op.tem"))
  241. $picaddress = _StringBetween($picall, "<title>" ,"</title>")
  242. $pica = _StringBetween($picall, "img src=""" ,"""")
  243. For $i = 0 to UBound($pica) -1 Step 1
  244.   $picnameget = StringSplit($pica[$i] ,"/")
  245.   $picname = $picnameget[$picnameget[0]]
  246.   InetGet ($pica[$i] , $path & "\" & $picname,0,1)
  247.   $size = InetGetSize ($pica[$i])
  248.   Do
  249.    Sleep(500)
  250.    GUICtrlSetData ($loading, "相册名:" & $picaddress[0] & @CRLF & "正在下载:" & $picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($pica) - $i -1 & @CRLF)
  251.   Until @InetGetActive = 0
  252.   GUICtrlSetImage ($pic, $path & "\" & $picname)
  253. Next
  254. EndFunc
  255. Func wbpic()
  256. $1picall = StringStripCR(FileRead("wb.tem"))
  257. $temp1 = _StringBetween($1picall, "<title>" ,"</title>")
  258. $1picaddress = StringTrimLeft (StringStripWS($temp1[0],8) ,29)
  259. $1pica = _StringBetween($1picall, "['" ,"'")
  260. For $i = 0 to UBound($1pica) -1 Step 1
  261.   $1picnameget = StringSplit($1pica[$i] ,"/")
  262.   $1picname = $1picnameget[$1picnameget[0]]
  263.   InetGet ($1pica[$i] , $path & "\" & $1picname,0,1)
  264.   $1size = InetGetSize ($1pica[$i])
  265.   Do
  266.    Sleep(500)
  267.    GUICtrlSetData ($loading, "相册名:" & $1picaddress & @CRLF & "正在下载:" & $1picname & @CRLF & "已下载:" & Round(@InetGetBytesRead /1024,4) & "kb(" & Round(@InetGetBytesRead / $1size,2) * 100 & "%)" & @CRLF & "剩余图片数:" & UBound($1pica) - $i -1 & @CRLF)
  268.   Until @InetGetActive = 0
  269.   GUICtrlSetImage ($pic, $path & "\" & $1picname)
  270. Next
  271. EndFunc
  272. Func CheckNew()
  273. $CheckNewCompelete = InetGet ( "http://files.myopera.com/z8519312/files/ver.txt", "ver.tem",1,0)
  274. If $CheckNewCompelete = 0 Then
  275.   MsgBox(0,"错误","网络连接失败")
  276. Else
  277.   $NewVersion = FileReadLine ( "ver.tem" ,1)
  278.   $DownloadLink = FileReadLine ( "ver.tem" ,2)
  279.   FileDelete("*.tem")
  280.   If $NewVersion = $version Then
  281.    MsgBox(0,"","当前版本已经是新版本")
  282.    WinActivate ("关于")
  283.   Else
  284.    $DownloadOrNot = MsgBox(4,"","已有更新版本,版本号为" & $NewVersion & ".是否更新?")
  285.    If $DownloadOrNot = 6 Then
  286.     RunWait(@ComSpec & " /c " & "start " & $DownloadLink & """", "", @SW_HIDE )
  287.    Else
  288.     ;;
  289.    EndIf
  290.   EndIf
  291. EndIf
  292. EndFunc
  293. Func wincontrol($number)
  294. If $number = 1 Then
  295.   GUICtrlSetState($Button_9,$GUI_DISABLE)  
  296.   GUICtrlSetState($about,$GUI_DISABLE)
  297.   GUICtrlSetState($cancel,$GUI_DISABLE)
  298.   GUICtrlSetState($tab,$GUI_DISABLE)  
  299. ElseIf $number = 2 Then
  300.   GUICtrlSetState($Button_9,$GUI_ENABLE)  
  301.   GUICtrlSetState($about,$GUI_ENABLE)  
  302.   GUICtrlSetState($cancel,$GUI_ENABLE)
  303.   GUICtrlSetState($tab,$GUI_ENABLE)
  304.   FileDelete("*.tem")
  305. EndIf
  306. EndFunc
  307. Func _StringBetween($sString, $sStart, $sEnd, $vCase = -1, $iSRE = -1)
  308.     If $iSRE = -1 Or $iSRE = Default Then
  309.         If $vCase = -1 Or $vCase = Default Then $vCase = 0
  310.         If $vCase <> -1 And $vCase <> Default Then $vCase = 1
  311.         Local $sHold = '', $sSnSStart = '', $sSnSEnd = ''
  312.         While StringLen($sString) > 0
  313.             $sSnSStart = StringInStr($sString, $sStart, $vCase)
  314.             If Not $sSnSStart Then ExitLoop
  315.             $sString = StringTrimLeft($sString, ($sSnSStart + StringLen($sStart)) - 1)
  316.             $sSnSEnd = StringInStr($sString, $sEnd, $vCase)
  317.             If Not $sSnSEnd Then ExitLoop
  318.             $sHold &= StringLeft($sString, $sSnSEnd - 1) & Chr(1)
  319.             $sString = StringTrimLeft($sString, $sSnSEnd)
  320.         WEnd
  321.         If Not $sHold Then Return SetError(1, 0, 0)
  322.         $sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1))
  323.         Local $aArray[UBound($sHold) - 1]
  324.         For $iCC = 1 To UBound($sHold) - 1
  325.             $aArray[$iCC - 1] = $sHold[$iCC]
  326.         Next
  327.         Return $aArray
  328.     Else
  329.         If $vCase = Default Or $vCase = -1 Then $vCase = '(?i)'
  330.         If $vCase <> Default And $vCase <> -1 Then $vCase = ''
  331.         Local $aArray = StringRegExp($sString, '(?s)' & $vCase & $sStart & '(.*?)' & $sEnd, 3)
  332.         If IsArray($aArray) Then Return $aArray
  333.         Return SetError(1, 0, 0)
  334.     EndIf
  335. EndFunc
复制代码
感谢Baidu,Google,Dreams8给我这次机会!
还要感谢我的爸爸妈妈!
HOHO
真的可以吗???
真爽,我已经做好了,哈哈,谢谢了
返回列表