From 892759da6c734b8c6daa0a59ebea01e566c18b0a Mon Sep 17 00:00:00 2001 From: Caleb Webber Date: Sun, 10 Nov 2024 19:37:49 -0500 Subject: [PATCH] fix get_input --- lib/aoc.ex | 4 +++- lib/get_input.ex | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/aoc.ex b/lib/aoc.ex index a3527d8..4efa2d5 100644 --- a/lib/aoc.ex +++ b/lib/aoc.ex @@ -3,9 +3,11 @@ defmodule AoC do defp get_request_headers!(), do: [Cookie: "session=#{get_session!()}"] def fetch_input!(year, day) do + Application.ensure_all_started(:req) + Req.get!( "https://adventofcode.com/#{year}/day/#{day}/input", - get_request_headers!() + headers: get_request_headers!() ) |> Map.get(:body) end diff --git a/lib/get_input.ex b/lib/get_input.ex index c428abe..7f65b3d 100644 --- a/lib/get_input.ex +++ b/lib/get_input.ex @@ -4,10 +4,6 @@ defmodule Mix.Tasks.GetInput do write_file = &File.write("./input/#{year}_#{day}.txt", &1) AoC.fetch_input!(year, day) - |> then(fn i -> - IO.puts(i) - i - end) |> write_file.() end end