aoc/get_input.sh
2024-08-13 08:32:35 -07:00

21 lines
380 B
Bash
Executable File

#!/usr/bin/env sh
get(){
curl -s --cookie "session=$1" "$2" | perl -pe 'chomp if eof' > "$3"
}
rm -rf input
for year in {2015..2023}; do
mkdir -p input/"$year"
for day in {1..25}; do
if [[ day -lt 10 ]]; then
d="0$day"
else
d="$day"
fi
url="https://adventofcode.com/$year/day/$day/input"
get "$1" "$url" "input/$year/$d"
done
touch "input/$year/test"
done