-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetInput
More file actions
executable file
·16 lines (13 loc) · 843 Bytes
/
getInput
File metadata and controls
executable file
·16 lines (13 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/zsh
# set TZ so that we get the correct day within the first 24 hours of the published puzzle
export TZ=America/New_York
# The URL uses un-padded day numbers, but we need 0-padded day numbers for the output file.
id=${1:-$(date '+%-d')}
od=${2:-$(date '+%d')}
day="input/Day${od}.txt"
# The input is not the same for all participants, and we thus have to pass our session cookie value. HTTPie supports
# storing and using session context (incl. cookies) in a JSON file. If you need to renew the cookie, log into the web
# site, then copy the session cookie value from the "Storage" tab of "Web Developer Tools" into the session file. The
# session file should be located at ~/.httpie/sessions/adventofcode.com/2023.json
https --download --quiet --output $day --session-read-only=2023 \
"https://adventofcode.com/2023/day/$id/input"