News for hackers. Stuff that matters.
Re:Advent of Code 2024 by wodenokoto on Sunday December 01, 2024 @11:55AM (#42289313)
People here are doing it in Common Lisp and C standard library, meanwhile I’m just sitting here trying to get a curl call to download the data file.
Re:Advent of Code 2024 by eddsolves on Sunday December 01, 2024 @12:14PM (#42289415)
I just copy and paste into a local text file, but I bet there’s a tool if you want to do it programmatically already (unless curl’ing is your idea of fun!)
Re:Advent of Code 2024 by yoyohello13 on Sunday December 01, 2024 @12:33PM (#42289532)
Copy your session token into .token then:

curl "https://adventofcode.com/2024/day/$DAY/input" --header "Cookie: $(cat .token)" > input.txt

Re:Advent of Code 2024 by sva_ on Sunday December 01, 2024 @12:53PM (#42289663)
You could open the dev console in the browser and copy the curl command off the network tab
Re:Advent of Code 2024 by hoistbypetard on Sunday December 01, 2024 @12:56PM (#42289680)
The command line tool included with this python library does just what you want once you paste your session token into an environment variable:

https://github.com/wimglenn/advent-of-code-data

Re:Advent of Code 2024 by ljouhet on Sunday December 01, 2024 @04:04PM (#42290718)
You can use Firefox: "Copy as cUrl" (https://superuser.com/a/1382425)
Re:Advent of Code 2024 by Symbiote on Sunday December 01, 2024 @04:13PM (#42290773)
Assuming you already opened it in a web browser, why not right click the page and choose "Save As"?
Re:Advent of Code 2024 by tocariimaa on Sunday December 01, 2024 @05:02PM (#42291059)
I have this script:

  #!/bin/sh
  set -e
  curl "https://adventofcode.com/${YEAR:?}/day/${DAY:?}/input" --cookie "session=$(cat .token)"
then: YEAR=2024 DAY=1 ./aocdata