$sFileUrl = 'https://huankong233.lanzoue.com/b0eay044h#35su'
_FileDown($sFileUrl)
Func _FileDown($Url)
Local $tempJson, $temparr, $tempFileName, $tempFilePath = @ScriptDir & '\'
Local $sFileUrlSplit = StringSplit($Url, '#', 1)
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
If @error Then Return
$oHTTP.Option(4) = 13056 ;忽略错误标志
$oHTTP.Option(6) = True ;是否接收重定向地址信息
$oHTTP.SetTimeouts(60000, 60000, 60000, 60000)
$tempJson = BinaryToString(_GetData($oHTTP, 'https://api.huankong.top/lanzou/?url=' & $sFileUrlSplit[1] & '&pass=' & $sFileUrlSplit[2]), 1)
;ConsoleWrite($tempJson & @CRLF)
$temparr = StringRegExp($tempJson, '(?i)^.+?fileName.+?\:"(.+?)".+?fileId"\:"(.+?)"\}', 3)
If @error Then
$oHTTP = 0
Return
EndIf
$tempFileName = $temparr[0]
$tempJson = BinaryToString(_GetData($oHTTP, 'https://api.huankong.top/lanzou/?fileId=' & $temparr[1]), 1)
;ConsoleWrite($tempJson & @CRLF)
$temparr = StringRegExp($tempJson, '(?i)fileUrl"\:"(.+?)"\}', 3)
If @error Then
$oHTTP = 0
Return
EndIf
;ConsoleWrite(StringReplace($temparr[0], '\', '') & @CRLF)
$fSource = _GetData($oHTTP, StringReplace($temparr[0], '\', ''))
_FileWrite($tempFilePath & $tempFileName, $fSource)
$oHTTP = 0
EndFunc ;==>_FileDown
Func _FileWrite($Path, $sData)
Local $hFileOpen = FileOpen(StringRegExpReplace($Path, '(.+?)(\..+)', '$1_' & _GetLocalTime() & '$2'), 1 + 16)
If $hFileOpen = -1 Then Return
FileWrite($hFileOpen, $sData)
FileClose($hFileOpen)
EndFunc ;==>_FileWrite
Func _GetData($oHTTP, $Url)
$oHTTP.Open('GET', $Url)
$oHTTP.SetRequestHeader('Accept-Language', 'zh-CN,zh;q=0.9')
$oHTTP.SetRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36')
$oHTTP.Send()
$oHTTP.WaitForResponse()
Return $oHTTP.ResponseBody
EndFunc ;==>_GetData
Func _GetLocalTime()
Local $tLocalTime = DllStructCreate('struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct')
DllCall('kernel32.dll', 'none', 'GetLocalTime', 'struct*', $tLocalTime)
Local $tLocalTimeValue = $tLocalTime.Year & StringRight('00' & $tLocalTime.Month, 2) & StringRight('00' & $tLocalTime.Day, 2) & StringRight('00' & $tLocalTime.Hour, 2) & StringRight('00' & $tLocalTime.Minute, 2) & StringRight('00' & $tLocalTime.Second, 2)
$tLocalTime = 0
Return $tLocalTimeValue
EndFunc ;==>_GetLocalTime