moth/docs/download-everything.md

31 lines
1.2 KiB
Markdown
Raw Normal View History

2023-11-21 13:05:55 -07:00
Download All Unlocked Puzzles
========================
We get a lot of requests to "download everything" from an event.
Here's how you could do that:
What You Need
------------
* The URL to your puzzle server. We will call this `$url`.
* Your Team ID. We will call this `$teamid`.
2023-11-21 13:10:44 -07:00
* A way to POST `id=$teamid`
with `Content-Type: x-www-form-encoded` to a URL,
and save the result.
We will call this procedure "Fetch".
2023-11-21 13:05:55 -07:00
* A way to parse JSON files
Steps
-----
1. Fetch `$url/state`. This is the State object.
2. In the State object, `Puzzles` maps category name to a list of open puzzle point values.
3. For each category (we will call this `$category`):
1. For each point value:
1. If the point value is 0, skip it. 0 indicates all puzzles in this category are unlocked.
2. Fetch `$url/content/$category/$points/index.json`. This is the Puzzle object.
3. In the Puzzle object, `Body` contains the HTML body of the puzzle.
2023-11-21 13:10:44 -07:00
4. In the Puzzle object, `Attachments` contains a list of attachments.
For each attachment (we will call this `$attachment`):
2023-11-21 13:05:55 -07:00
1. Fetch `$url/content/$category/$points/$attachment`.