Advent of Code Helper
A small, basic, utility package to help pull down the input (maybe more, like submit, in the future).
dotnet add package NAoCHelper
Search for NAoCHelper
in your package manager of choice.
-
Create an
appsettings.json
in your project root that looks like the following;{ "Secrets": { "Cookie": "Configured in User Secrets" } }
-
Run
dotnet user-secrets init
to add secret management to your project. Take note of the User Secrets ID. -
Run
dotnet user-secrets set Secrets:Cookie session=...
to set your cookie (see Notes section for how to find it). -
Use code like the following to get your puzzle input;
using NAoCHelper; ... var user = new User(Helpers.GetCookie("YourUserSecretsID")); var puzzle = new Puzzle(user, 2019, 1); Console.WriteLine(puzzle.GetInputAsync().Result);
This requires the cookie for your session. Use dev-tools to find this in the request headers, it should look like cookie: session=536...
, save the value only (session=536...
).