{"id":16656005,"url":"https://github.com/mcrumm/req_aoc","last_synced_at":"2025-06-23T03:36:50.068Z","repository":{"id":64191529,"uuid":"573715218","full_name":"mcrumm/req_aoc","owner":"mcrumm","description":"Elixir Req plugin to download Advent of Code input","archived":false,"fork":false,"pushed_at":"2022-12-07T20:34:43.000Z","size":22,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T18:21:32.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcrumm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["mcrumm"]}},"created_at":"2022-12-03T07:30:45.000Z","updated_at":"2022-12-03T19:50:21.000Z","dependencies_parsed_at":"2023-01-15T03:46:09.912Z","dependency_job_id":null,"html_url":"https://github.com/mcrumm/req_aoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcrumm/req_aoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Freq_aoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Freq_aoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Freq_aoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Freq_aoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcrumm","download_url":"https://codeload.github.com/mcrumm/req_aoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Freq_aoc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259919461,"owners_count":22932073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T09:55:59.616Z","updated_at":"2025-06-15T04:08:27.225Z","avatar_url":"https://github.com/mcrumm.png","language":"Elixir","funding_links":["https://github.com/sponsors/mcrumm"],"categories":[],"sub_categories":[],"readme":"# ReqAOC\n\nhttps://user-images.githubusercontent.com/168677/205474609-778654e1-cdf2-4812-b567-bda456717800.mov\n\n[![Run in Livebook](https://livebook.dev/badge/v1/blue.svg)](https://livebook.dev/run?url=https://github.com/mcrumm/req_aoc/blob/main/guides/usage.livemd)\n\n\u003c!-- MDOC --\u003e\n\nElixir Req plugin to download [Advent of Code][aoc] input.\n\n[![CI](https://github.com/mcrumm/req_aoc/actions/workflows/ci.yml/badge.svg)](https://github.com/mcrumm/req_aoc/actions/workflows/ci.yml)\n\n## Usage\n\nThe easiest way to use Req is with `Mix.install/2` (requires Elixir v1.12+):\n\n```elixir\nMix.install([\n  {:req_aoc, github: \"mcrumm/req_aoc\", ref: \"9f1371b\"}\n])\n\nSystem.fetch_env!(\"AOC_SESSION\") |\u003e ReqAOC.fetch!({2022, 01})\n# ==\u003e \"...\"\n```\n\nIf you want to use ReqAOC in a Mix project, you can add the above dependency to your `mix.exs`.\n\nYou can also attach ReqAOC to an existing `Req.Request`:\n\n```elixir\nreq = Req.new() |\u003e ReqAOC.attach()\nreq |\u003e Req.get!(aoc: {2022, 01, \"my-session-id-from-dev-tools\"})\n# ==\u003e %Req.Response{body: \"...\"}\n```\n\n### Livebook\n\nIn [Livebook](https://livebook.dev) you can store your session token as an **app secret** so you\ncan reuse it across multiple sessions and multiple notebooks. For example, if you create a secret\nnamed `AOC_SESSION`, then you can use the following code snippet to fetch your AoC input:\n\n```elixir\nSystem.fetch_env!(\"LB_AOC_SESSION\") |\u003e ReqAOC.fetch!({2022, 01})\n```\n\n## How to get your session cookie\n\nPuzzle inputs differ by user. For this reason, you can't get your data with an unauthenticated request. Here's how to get your session cookie for ReqAOC to use:\n\n* Log in on [Advent of Code][aoc] via any available provider.\n* Open your browser's developer console (e.g. right click --\u003e Inspect) and navigate to the Network tab.\n* GET any input page, for example https://adventofcode.com/2022/day/1/input, and search in the **request headers**.\n* It's a long hex string. You want the part that comes _after_ `Cookie: session=`. Save that to a system environment variable or a Livebook app secret called `AOC_SESSION`.\n\n[![Finding your session token](https://cloud.githubusercontent.com/assets/6615374/20862970/0922a4fe-b980-11e6-8f30-5967ca494f5e.png)](https://github.com/wimglenn/advent-of-code-wim/issues/1)\n\n[aoc]: https://adventofcode.com\n\n\u003c!-- MDOC --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Freq_aoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcrumm%2Freq_aoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Freq_aoc/lists"}