我目前正在使用comobject adodb.stream作为经过身份验证的用户从archive.org抓取非常大的文件(多个gb),因此在分配时收到了内存不足错误。有没有一种使用adodb.stream设置块大小并将其附加/连接到输出文件的方法?
欢迎使用其他解决方案。
在这里,我正在使用AHKscript:
file_save_location := save
Overwrite := True
get_site := "https://archive.org/download/file.zip" ;;multi-gb file
post_site :="https://archive.org/account/login.php"
post_data :="username=" username_str "&password=" password_str "&remember=CHECKED&referer=https://archive.org&action=login&submit=Log in"
WebRequest := ComObjCreate( "WinHttp.WinHttpRequest.5.1" )
WebRequest.Open("POST", post_site)
WebRequest.SetRequestHeader("Content-Type", "application / zip, application / octet - stream""application / zip, application / octet - stream")
WebRequest.SetRequestHeader("Cookie", "test-cookie=1")
WebRequest.SetRequestHeader("Accept-Encoding","gzip,deflate,sdch")
WebRequest.Send(post_data)
WebRequest.Open("HEAD",get_site)
WebRequest.Send()
WebRequest.Open("GET",get_site)
WebRequest.Send()
ADODBObj := ComObjCreate( "ADODB.Stream" )
ADODBObj.Type := 1
ADODBObj.Open()
;;ADODBObj.Position := 0 ;;getting warm
ADODBObj.Write( WebRequest.ResponseBody )
ADODBObj.SaveToFile(file_save_location, Overwrite ? 2:1)
ADODBObj.Close()
ADODBObj:=""
WebRequest:=""