@crawlora-org/flashscore 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @crawlora-org/flashscore
2
2
 
3
3
  JavaScript and TypeScript client for Crawlora's hosted Flashscore API.
4
- It calls Crawlora's service; it does not run a browser or scrape Flashscore 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 Flashscore or its owners.
4
+ It calls [Crawlora](https://crawlora.net); it does not run a browser or scrape Flashscore 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 Flashscore or its owners.
5
5
 
6
6
  ## Install
7
7
 
@@ -9,14 +9,29 @@ It calls Crawlora's service; it does not run a browser or scrape Flashscore loca
9
9
  npm install @crawlora-org/flashscore
10
10
  ```
11
11
 
12
+ ## Get an API key
13
+
14
+ Create an account at [crawlora.net](https://crawlora.net/signup), then open the [Crawlora console](https://crawlora.net/app) 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
+
12
20
  ## Use
13
21
 
22
+ Save this example as `example.mjs`, then run `node example.mjs` after installing the package and setting your API key.
23
+
14
24
  ```js
25
+ import process from "node:process";
15
26
  import { FlashscoreClient } from "@crawlora-org/flashscore";
16
27
 
17
- const client = new FlashscoreClient({ apiKey: process.env.CRAWLORA_API_KEY });
18
- const result = await client.sports({ });
19
- console.log(result);
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 FlashscoreClient({ apiKey });
31
+ const result1 = await client.sports({});
32
+ console.log(result1);
33
+ const result2 = await client.scores({ sport: "football", day_offset: 0 });
34
+ console.log(result2);
20
35
  ```
21
36
 
22
37
  The client also exports `Client` as an alias for `FlashscoreClient`. Operation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlora-org/flashscore",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Typed JavaScript client for the Crawlora Flashscore API",
5
5
  "homepage": "https://github.com/Crawlora-org/crawlora-flashscore#readme",
6
6
  "bugs": { "url": "https://github.com/Crawlora-org/crawlora-flashscore/issues" },
package/src/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  export class FlashscoreClient extends CrawloraClient {
11
11
  constructor(options = {}) {
12
- super({ ...options, userAgent: options.userAgent ?? "crawlora-flashscore-js/0.1.1" });
12
+ super({ ...options, userAgent: options.userAgent ?? "crawlora-flashscore-js/0.1.3" });
13
13
  this["calendar"] = (...args) => this.request("flashscore-calendar", ...args);
14
14
  this["calendarCategories"] = (...args) => this.request("flashscore-calendar-categories", ...args);
15
15
  this["competitions"] = (...args) => this.request("flashscore-competitions", ...args);
@@ -46,5 +46,5 @@ export {
46
46
  CrawloraServerError
47
47
  };
48
48
  export { groups, operations, operationCount, OperationIds } from "./operations.js";
49
- export const VERSION = "0.1.1";
49
+ export const VERSION = "0.1.3";
50
50
  export default FlashscoreClient;