Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;AoC_day := 13
- AoC_session := "513616c74a42205f6b453616c74a42205f6b4b1" ; <- not my real session
- AoC_file := Format("day{}_input.txt",(AoC_day && A_Year==2020)?AoC_day:(A_DD*1))
- if !FileExist(AoC_file) {
- cookie := Format("session={}; domain=.adventofcode.com; HttpOnly",AoC_session)
- url := Format("https://adventofcode.com/2020/day/{}/input",(AoC_day && A_Year==2020)?AoC_day:(A_DD*1))
- try {
- hObj := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
- hObj.open("GET",url,false)
- hObj.SetRequestHeader("Cookie", cookie)
- hObj.send()
- OutputDebug, % Format("Success! Received Input data: {} characters.",StrLen(hObj.responseText))
- FileAppend, % SubStr(hObj.responseText,1,-1), % AoC_file
- } catch e {
- OutputDebug, % Format("Error[{}]: {} {} {}",,e.line,e.message,e.extra,e.what)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment