Skip to content

Commit c4622e5

Browse files
committed
identify myself in User-Agent header
1 parent cfc5dd5 commit c4622e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

2021/fetchinput

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ if [[ -z "$DAY" ]]; then
2020
print -u 2 "Non-numeric year/day $1/$2"
2121
exit 1
2222
fi
23+
# Include contact information per requst from @topaz
24+
USER_AGENT="https://github.com/flwyd/adventofcode by [email protected]"
2325
COOKIES="$BASEDIR/.cookie-jar"
2426
if [[ ! -s "$COOKIES" ]]; then
2527
print -u 2 "Who stole the cookies from ${COOKIES}?"
@@ -33,4 +35,4 @@ if [[ "$SERVERDAY" < "$TARGETDAY" ]]; then
3335
fi
3436
URL="https://adventofcode.com/$YEAR/day/$DAY/input"
3537
print -u 2 "Fetching $URL"
36-
curl -f -b "$COOKIES" "$URL"
38+
curl -f -b "$COOKIES" -A "$USER_AGENT" "$URL"

2022/fetchinput

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ if [[ -z "$DAY" ]]; then
2020
print -u 2 "Non-numeric year/day $1/$2"
2121
exit 1
2222
fi
23+
# Include contact information per requst from @topaz
24+
USER_AGENT="https://github.com/flwyd/adventofcode by [email protected]"
2325
COOKIES="$BASEDIR/.cookie-jar"
2426
if [[ ! -s "$COOKIES" ]]; then
2527
print -u 2 "Who stole the cookies from ${COOKIES}?"
@@ -33,4 +35,4 @@ if [[ "$SERVERDAY" < "$TARGETDAY" ]]; then
3335
fi
3436
URL="https://adventofcode.com/$YEAR/day/$DAY/input"
3537
print -u 2 "Fetching $URL"
36-
curl -f -b "$COOKIES" "$URL"
38+
curl -f -b "$COOKIES" -A "$USER_AGENT" "$URL"

0 commit comments

Comments
 (0)