Heute geht es wieder um Zippyshare-Downloads, bzw. wie man diese einfach automatisieren kann. Da seit meinem letzten Beitrag zu diesem Thema die Seite wieder einige Umstellungen gemacht hat, präsentiere ich hier meine neue AutoIT Lösung:
; #FUNCTION# ====================================================================================================================
; Name ..........: _ZippyLoad
; Description ...: Download a file from zippyshare.com
; Syntax ........: _ZippyLoad($sUrl, $sFilename)
; Parameters ....: $sUrl - Downloadpage, eg. http://www01.zippyshare.com/view.jsp?locale=de&key=12345678 or http://www01.zippyshare.com/v/12345678/file.html
; $sFilename - Path to where the download should be saved, eg. C:test.mp3
; Return values .: False on error, InetGet-Handle on success
; Author ........: www.agrafix.net
; Modified ......: 17.11.2011 - 15:57
; Remarks .......: None
; Related .......: _ZippyIsComplete
; Link ..........: http://blog.agrafix.net/tag/zippyshare/
; Example .......: No
; License .......: CC BY-NC 3.0
; ===============================================================================================================================
Func _ZippyLoad($sUrl, $sFilename)
; RegExp
$sRegExp = ''
$sRegExp &= 's*var a = ([0-9]*)%([0-9]*);'
$sRegExp &= 's*var b = ([0-9]*)%([0-9]*);'
$sRegExp &= 's*document.getElementById(.dlbutton.).href = "([^"]*)"+(([ab*+-/0-9]*))+"([^"]*)";'
$sRegExp &= 's*'
; Extract Host
$aHostMatches = StringRegExp($sURL, 'http://([^/]*)', 1)
$sHost = $aHostMatches[0]
If @error = 1 Or @error = 2 Then
SetError(1)
Return False ; Invalid Host
EndIf
; Get Downloading Page
$sSource = _INetGetSource($sURL)
; Extract Params for Download-URL
$aMatches = StringRegExp($sSource, $sRegExp, 1)
If @error = 1 Or @error = 2 Then
SetError(2)
Return False ; Downloading failed
EndIf
$iVarA = Mod($aMatches[0], $aMatches[1])
$iVarB = Mod($aMatches[2], $aMatches[3])
$sMathExpr = StringReplace(StringReplace($aMatches[5], "a", $iVarA), "b", $iVarB)
$iResult = Execute($sMathExpr)
$sBaseUrl = $aMatches[4] & $iResult & $aMatches[6]
$sFullPath = "http://" & $sHost & $sBaseUrl
; Download File
$hHandle = InetGet($sFullPath, $sFilename, 1, 1)
ConsoleWrite("Downloading " & $sFullPath & " to " & $sFilename & @CRLF)
Return $hHandle
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _ZippyIsComplete
; Description ...: Check if a download launched with _ZippyLoad is complete
; Syntax ........: _ZippyIsComplete($hHandle)
; Parameters ....: $hHandle - the handle returned from _ZippyLoad
; Return values .: True if download is complete, False if not
; Author ........: www.agrafix.net
; Modified ......: 17.11.2011 - 15:57
; Remarks .......: None
; Related .......: _ZippyLoad
; Link ..........: http://blog.agrafix.net/tag/zippyshare/
; Example .......: No
; License .......: CC BY-NC 3.0
; ===============================================================================================================================
Func _ZippyIsComplete($hHandle)
Return InetGetInfo($hHandle, 2)
EndFunc
Die Verwendung dieser Funktionen ist denkbar einfach:
#include
$h = _ZippyLoad("http://www01.zippyshare.com/view.jsp?locale=de&key=12345678", @ScriptDir & "test.mp3")
While Not _ZippyIsComplete($h)
Sleep(250)
WEnd
ConsoleWrite("Download complete..." &@CRLF)
Der Code steht zur freien Verwendung unter der CC BY-NC 3.0 Lizenz.