Advent of Code Get (aocget)
A small lib to download your puzzle input for a given day.
Uses your session token to authenticate to obtain your personalized input.
Getting your Session Token
- Login to Advent of Code
- Open your browser's DevTools (usually F12)
- Head over to your cookies
- Copy the
value
of thesession
cookie
Example
package main
import (
"fmt"
"github.com/Zyian/aocget"
"os"
)
func main() {
aoc := aocget.NewClient(os.Getenv("SESSION_TOKEN"))
i, err := aoc.DownloadInputString(2021, 1)
if err != nil {
fmt.Printf("unable to download input: %v\n", err)
os.Exit(1)
}
fmt.Println(i)
}