@crawlora-org/speedrun 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -2
- package/package.json +32 -4
- package/src/client.js +582 -0
- package/src/index.d.ts +163 -0
- package/src/index.js +46 -0
- package/src/operations.js +1115 -0
- package/src/types.d.ts +379 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crawlora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @crawlora-org/speedrun — Speedrun.com API client for JavaScript and TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JavaScript and TypeScript client for Crawlora's hosted Speedrun.com API.
|
|
4
|
+
It exposes 20 API endpoints for game and category discovery, leaderboards, records, variables, and run metadata through [Crawlora](https://crawlora.net/?utm_source=npm&utm_medium=referral&utm_campaign=platform-clients&utm_content=speedrun-javascript-homepage). It does not run a browser or scrape Speedrun.com locally. A Crawlora account and `CRAWLORA_API_KEY` are required, and API use is billed under your Crawlora account. Crawlora is independent from and not endorsed by Speedrun.com or its owners.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @crawlora-org/speedrun
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Get an API key
|
|
13
|
+
|
|
14
|
+
Create an account at [crawlora.net](https://crawlora.net/signup?utm_source=npm&utm_medium=referral&utm_campaign=platform-clients&utm_content=speedrun-javascript-signup), then open the [Crawlora console](https://crawlora.net/app?utm_source=npm&utm_medium=referral&utm_campaign=platform-clients&utm_content=speedrun-javascript-console) for API-key setup. Set your key in the shell before running the client:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
export CRAWLORA_API_KEY="your-crawlora-api-key"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
|
|
22
|
+
Save this example as `example.mjs`, then run `node example.mjs` after installing the package and setting your API key.
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import process from "node:process";
|
|
26
|
+
import { SpeedrunClient } from "@crawlora-org/speedrun";
|
|
27
|
+
|
|
28
|
+
const apiKey = process.env.CRAWLORA_API_KEY;
|
|
29
|
+
if (!apiKey) throw new Error("Set CRAWLORA_API_KEY before running this example.");
|
|
30
|
+
const client = new SpeedrunClient({ apiKey });
|
|
31
|
+
const result1 = await client.games({ name: "Super Mario 64", max: 5 });
|
|
32
|
+
console.log(result1);
|
|
33
|
+
const result2 = await client.resourceOptions({});
|
|
34
|
+
console.log(result2);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The client also exports `Client` as an alias for `SpeedrunClient`. Operation
|
|
38
|
+
methods are available directly in camelCase and through the `speedrun`
|
|
39
|
+
group. See the full method and parameter list in the [online reference](https://github.com/Crawlora-org/crawlora-speedrun/blob/main/docs/usage.md).
|
|
40
|
+
|
|
41
|
+
Methods return promises and can be awaited. See the [runnable example](https://github.com/Crawlora-org/crawlora-speedrun/blob/main/examples/javascript.mjs) for a complete usage example.
|
|
42
|
+
|
|
43
|
+
## Supported Speedrun.com API endpoints
|
|
44
|
+
|
|
45
|
+
This package exposes each route below as a direct method and through the `speedrun` group. See the [endpoint and parameter reference](https://github.com/Crawlora-org/crawlora-speedrun/blob/main/docs/usage.md) for complete input details.
|
|
46
|
+
|
|
47
|
+
| Method | Endpoint | API operation | Description |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `GET` | `/speedrun/catalogs/{kind}` | `speedrun-catalog` | Discover Speedrun.com filter catalogs |
|
|
50
|
+
| `GET` | `/speedrun/categories/{id}` | `speedrun-category-detail` | Get Speedrun category detail |
|
|
51
|
+
| `GET` | `/speedrun/categories/{id}/records` | `speedrun-category-records` | Get Speedrun category records |
|
|
52
|
+
| `GET` | `/speedrun/categories/{id}/variables` | `speedrun-category-variables` | Get Speedrun category variables |
|
|
53
|
+
| `GET` | `/speedrun/games` | `speedrun-games` | Search Speedrun.com games |
|
|
54
|
+
| `GET` | `/speedrun/games/{id}` | `speedrun-game-detail` | Get Speedrun game detail |
|
|
55
|
+
| `GET` | `/speedrun/games/{id}/categories` | `speedrun-categories` | Get native game categories |
|
|
56
|
+
| `GET` | `/speedrun/games/{id}/levels` | `speedrun-levels` | Get native game levels |
|
|
57
|
+
| `GET` | `/speedrun/games/{id}/records` | `speedrun-records` | Get native top-one game record boards |
|
|
58
|
+
| `GET` | `/speedrun/games/{id}/variables` | `speedrun-variables` | Get native game variable definitions |
|
|
59
|
+
| `GET` | `/speedrun/leaderboards/{game}/category/{category}` | `speedrun-game-leaderboard` | Get a Speedrun full-game leaderboard |
|
|
60
|
+
| `GET` | `/speedrun/leaderboards/{game}/level/{level}/{category}` | `speedrun-level-leaderboard` | Get a Speedrun individual-level leaderboard |
|
|
61
|
+
| `GET` | `/speedrun/levels/{id}` | `speedrun-level-detail` | Get Speedrun level detail |
|
|
62
|
+
| `GET` | `/speedrun/levels/{id}/categories` | `speedrun-level-categories` | Get Speedrun level categories |
|
|
63
|
+
| `GET` | `/speedrun/levels/{id}/records` | `speedrun-level-records` | Get Speedrun level records |
|
|
64
|
+
| `GET` | `/speedrun/levels/{id}/variables` | `speedrun-level-variables` | Get Speedrun level variables |
|
|
65
|
+
| `GET` | `/speedrun/options` | `speedrun-resource-options` | Discover Speedrun contextual resource options |
|
|
66
|
+
| `GET` | `/speedrun/runs` | `speedrun-runs` | List native Speedrun run metadata |
|
|
67
|
+
| `GET` | `/speedrun/runs/options` | `speedrun-runs-options` | Discover Speedrun run query options |
|
|
68
|
+
| `GET` | `/speedrun/runs/{id}` | `speedrun-run` | Read native Speedrun run metadata |
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
Pass your key through `apiKey` or set `CRAWLORA_API_KEY` and read it from the
|
|
73
|
+
environment. Keep credentials out of source control and logs. Requests are
|
|
74
|
+
made to Crawlora's hosted API. Response data and availability depend on
|
|
75
|
+
Crawlora's current API behavior.
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlora-org/speedrun",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
}
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Crawlora Speedrun.com API client with 20 endpoints for game and category discovery, leaderboards, records, variables, and run metadata",
|
|
5
|
+
"homepage": "https://crawlora.net/?utm_source=npm&utm_medium=referral&utm_campaign=platform-clients&utm_content=speedrun-javascript-homepage",
|
|
6
|
+
"bugs": { "url": "https://github.com/Crawlora-org/crawlora-speedrun/issues" },
|
|
7
|
+
"keywords": ["crawlora", "api-client", "sdk", "web-scraping", "scraping-api", "speedrun", "speedrun-com", "speedrun-api", "speedrun-com-api", "speedrun-scraper", "speedrun-com-scraper", "speedrun-data", "speedrun-com-data", "speedrun-game-category-discovery", "speedrun-leaderboards", "speedrun-records", "speedrun-variables", "speedrun-run-metadata"],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./src/index.js",
|
|
10
|
+
"types": "./src/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./src/index.d.ts",
|
|
14
|
+
"import": "./src/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": ["src", "README.md", "LICENSE"],
|
|
18
|
+
"engines": { "node": ">=18" },
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/Crawlora-org/crawlora-speedrun",
|
|
23
|
+
"directory": "javascript"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "node --test test/*.test.js",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"pack:check": "npm pack --dry-run --ignore-scripts",
|
|
29
|
+
"generate": "python3 ../scripts/generate.py"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "5.8.3"
|
|
33
|
+
}
|
|
34
|
+
}
|