aocjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

🦌 aocjs

npm version npm downloads jsdocs

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.

  1. Open adventofcode.com and log in.
  2. Open your Chrome or Firefox Devtools (F12).
  3. Go to Application tab.
  4. On the sidebar, under Storage section, expand Cookies and click on https://adventofcode.com.
  5. 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.

Readme

Keywords

Package Sidebar

Install

npm i aocjs

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

8.87 kB

Total Files

9

Last publish

Collaborators

  • taskylizard