aocjs
v1.0.0
Published
Advent of Code API client.
Downloads
20
Readme
🦌 aocjs
Library for the Advent of Code API.
- Adds a User-Agent to identify as automated requests
- Written in TypeScript
🚧 This project is under heavy development.
Setup
Install:
[pnpm|npm|yarn|bun] init
[pnpm|npm|yarn|bun] install aocjs
At this point, you'll have to add your Advent of Code browser session key, this requires a few more steps.
- Open adventofcode.com and log in.
- Open your Chrome or Firefox Devtools (F12).
- Go to Application tab.
- On the sidebar, under Storage section, expand Cookies and click on https://adventofcode.com.
- Now you're seeing 3 cookies, one of them must be named session. Copy it's value.
Getting Started
// ESM
import { Client } from "aocjs";
// CommonJS
const { Client } = require("aocjs");
const client = new Client({ session: "53727...." });
const input = await client.getInput(2023, 7);
console.log(input); // Your input
Implementation matrix
- [x] Fetching input (
{year}/day/{day}/input
) - [ ] Submitting answers
- [ ] Fetching private/global leaderboard
- [ ] Ratelimits to reduce load on the site
- [ ] Respect Eric's wishes for load wherever possible
License
Copyright (c) 2023 taskylizard. MIT Licensed.