summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorcos <cos>2020-12-03 07:24:29 +0100
committercos <cos>2020-12-04 10:25:55 +0100
commit616e32ade5e53fc2388fb942c5b2202f5f0b333b (patch)
tree80bd7273bee7916901fcd35440f7fcd984a491f0 /bin
parent0604beeb60a9403e5fa2cf2f64825f9ee3f49a9a (diff)
downloadadventofcode-616e32ade5e53fc2388fb942c5b2202f5f0b333b.zip
Make fetch_input also save the instruction page
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetch_input.sh3
-rwxr-xr-xbin/init_rust.sh2
2 files changed, 4 insertions, 1 deletions
diff --git a/bin/fetch_input.sh b/bin/fetch_input.sh
index 76bdddd..3467871 100755
--- a/bin/fetch_input.sh
+++ b/bin/fetch_input.sh
@@ -37,12 +37,15 @@ if [ "${MODE}" = 'wget' ]; then
[ -e "input" ] || {
mkdir 'input'
+ authenticated_wget --output-document "input/page_${DEC}.html" \
+ "https://adventofcode.com/${YEAR}/day/${DEC}"
SETTINGS=$(authenticated_wget --output-document='-' \
"https://adventofcode.com/${YEAR}/settings")
USERNAME=$(echo "${SETTINGS}" |
sed -n 's#.*display_name.*checked.*<span>\(.*\)</span>.*#\1#p')
authenticated_wget --output-document "input/${USERNAME}" \
"https://adventofcode.com/${YEAR}/day/${DEC}/input"
+ elinks -dump "./input/page_${DEC}.html" >"input/page_${DEC}.txt"
}
elif [ "${MODE}" = 'aocdl' ]; then
# One could possibly use the golang implemenation instead of wget:
diff --git a/bin/init_rust.sh b/bin/init_rust.sh
index 38825b1..5388a69 100755
--- a/bin/init_rust.sh
+++ b/bin/init_rust.sh
@@ -6,7 +6,7 @@ DAY=${DAY:-$(TZ=EST date '+%d')}
GIT_USER=$(git config --get 'user.name')
GIT_EMAIL=$(git config --get 'user.email')
-CARGO=$( sed "s/^#\( *${DAY}\)/\1/" <"${YEAR}/rust/Cargo.toml")
+CARGO=$( sed "s/^#\(.*${DAY}\)/\1/" <"${YEAR}/rust/Cargo.toml")
echo "${CARGO}" >"${YEAR}/rust/Cargo.toml"
cd "${YEAR}/rust"