-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-input.sh
More file actions
29 lines (24 loc) · 865 Bytes
/
get-input.sh
File metadata and controls
29 lines (24 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
if [[ -z "$YEAR" ]]; then
echo "YEAR is not set"
exit 1
fi
if [[ -z "$DAY" ]]; then
echo "DAY is not set"
exit 1
fi
if [[ -z "$SESSION" ]]; then
echo "SESSION is not set"
exit 1
fi
if [[ -z "$1" ]]; then
echo "Please pass output file as first arg"
exit 2
fi
curl "https://adventofcode.com/$YEAR/day/$DAY/input" \
--compressed -A 'https://github.com/paciops/AdventOfCode' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' \
-H "Cookie: session=$SESSION" \
-H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' \
-H 'DNT: 1' -H 'Connection: keep-alive' -H 'Sec-GPC: 1' -H 'TE: trailers' > $1