colinodell/aoc-downloader

下载 Advent of Code 试题和输入数据

v0.1.3 2023-12-01 17:01 UTC

This package is auto-updated.

Last update: 2024-08-30 01:39:38 UTC


README

License Supported PHP Versions Packagist Version GitHub Workflow Status (branch) Sponsor this project

这是一个简单的基于 PHP 的工具,用于本地下载所有 Advent of Code 试题和输入数据。

要求

此项目需要 PHP 7.4 或更高版本。

安装

有三种方法可以下载和使用此工具

Composer 依赖

使用 PHP 处理 AoC 试题?您可以将它作为开发依赖项包含在您的仓库中

composer require --dev colinodell/aoc-downloader

独立 PHAR

不想混合依赖或更喜欢单个可执行文件?也可以通过 发行版标签 获取预编译的 PHAR。只需下载 .phar 文件,使其可执行,然后运行它。

从源代码

git clone https://github.com/colinodell/aoc-downloader.git
cd aoc-downloader
composer update -o --no-dev

使用方法

您需要登录到 adventofcode.com 并使用浏览器的开发者工具获取您的 session cookie

然后您可以将其作为参数传递给此工具

Usage:
  ./bin/aoc-downloader [options] [--] <session_id>

Arguments:
  session_id            Session ID (from the adventofcode.com `session` cookie

Options:
  -o, --output=OUTPUT   The directory to save the downloaded files [default: "./puzzles"]
  -y, --year=YEAR       The year to download puzzles for (default is all years)
  -h, --help            Display help for the given command. When no command is given display help for the ./bin/download.php command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

它将本地保存试题测试和输入数据

puzzles/2020
├── day01
│   ├── input.txt
│   └── README.md
├── day02
│   ├── input.txt
│   └── README.md
├── day03
│   ├── input.txt
│   └── README.md
├── day04
│   ├── input.txt
│   └── README.md
├── day05
│   ├── input.txt
│   └── README.md
├── day06
│   ├── input.txt
│   └── README.md
├── day07
│   ├── input.txt
│   └── README.md
├── day08
│   ├── input.txt
│   └── README.md
├── day09
│   ├── input.txt
│   └── README.md
├── day10
│   ├── input.txt
│   └── README.md
...