Guest User

Untitled

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