utils.R (405B)
1 aoc_input <- function(day, year = 2025) { 2 if (!file.exists("~/.aoc")) { 3 stop("AoC session ID must be present in ~/.aoc") 4 } 5 con <- url( 6 sprintf("https://adventofcode.com/%d/day/%d/input", year, day), 7 headers = c( 8 "Cookie" = paste0("session=", readLines("~/.aoc")), 9 "User-Agent" = "ec@eamoncaddigan.net" 10 ) 11 ) 12 puzzle_input <- readLines(con) 13 close(con) 14 puzzle_input 15 }