@crawlora-org/flashscore 0.1.2 → 0.2.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/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.2",
3
+ "version": "0.2.0",
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.d.ts CHANGED
@@ -92,18 +92,32 @@ export class FlashscoreClient extends CrawloraClient {
92
92
  matchHighlights(params: OperationParamsMap["flashscore-match-highlights"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
93
93
  matchInfo(params: OperationParamsMap["flashscore-match-info"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
94
94
  matchLineups(params: OperationParamsMap["flashscore-match-lineups"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
95
+ matchMissingPlayers(params: OperationParamsMap["flashscore-match-missing-players"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
95
96
  matchNews(params: OperationParamsMap["flashscore-match-news"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
97
+ matchOdds(params: OperationParamsMap["flashscore-match-odds"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
98
+ matchPredictedLineups(params: OperationParamsMap["flashscore-match-predicted-lineups"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
96
99
  matchStandings(params: OperationParamsMap["flashscore-match-standings"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
97
100
  matchStats(params: OperationParamsMap["flashscore-match-stats"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
101
+ matchTv(params: OperationParamsMap["flashscore-match-tv"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
98
102
  navigation(params?: OperationParamsMap["flashscore-navigation"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
99
103
  news(params?: OperationParamsMap["flashscore-news"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
100
104
  newsArticle(params: OperationParamsMap["flashscore-news-article"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
101
105
  newsCategories(params?: OperationParamsMap["flashscore-news-categories"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
106
+ oddsGeos(params?: OperationParamsMap["flashscore-odds-geos"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
107
+ player(params: OperationParamsMap["flashscore-player"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
108
+ playerInjuries(params: OperationParamsMap["flashscore-player-injuries"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
109
+ playerTransfers(params: OperationParamsMap["flashscore-player-transfers"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
102
110
  rankingCategories(params?: OperationParamsMap["flashscore-ranking-categories"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
103
111
  rankings(params: OperationParamsMap["flashscore-rankings"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
104
112
  scores(params: OperationParamsMap["flashscore-scores"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
105
113
  search(params: OperationParamsMap["flashscore-search"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
106
114
  sports(params?: OperationParamsMap["flashscore-sports"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
115
+ team(params: OperationParamsMap["flashscore-team"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
116
+ teamFixtures(params: OperationParamsMap["flashscore-team-fixtures"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
117
+ teamNews(params: OperationParamsMap["flashscore-team-news"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
118
+ teamResults(params: OperationParamsMap["flashscore-team-results"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
119
+ teamSquad(params: OperationParamsMap["flashscore-team-squad"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
120
+ teamTransfers(params: OperationParamsMap["flashscore-team-transfers"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
107
121
  topSearch(params?: OperationParamsMap["flashscore-top-search"], options?: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
108
122
  tournamentEvents(params: OperationParamsMap["flashscore-tournament-events"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
109
123
  tournamentSeasons(params: OperationParamsMap["flashscore-tournament-seasons"], options: CrawloraRequestOptions & { responseType: "stream" }): Promise<Response>;
@@ -118,18 +132,32 @@ export class FlashscoreClient extends CrawloraClient {
118
132
  matchHighlights(params: OperationParamsMap["flashscore-match-highlights"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
119
133
  matchInfo(params: OperationParamsMap["flashscore-match-info"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
120
134
  matchLineups(params: OperationParamsMap["flashscore-match-lineups"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
135
+ matchMissingPlayers(params: OperationParamsMap["flashscore-match-missing-players"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
121
136
  matchNews(params: OperationParamsMap["flashscore-match-news"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
137
+ matchOdds(params: OperationParamsMap["flashscore-match-odds"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
138
+ matchPredictedLineups(params: OperationParamsMap["flashscore-match-predicted-lineups"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
122
139
  matchStandings(params: OperationParamsMap["flashscore-match-standings"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
123
140
  matchStats(params: OperationParamsMap["flashscore-match-stats"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
141
+ matchTv(params: OperationParamsMap["flashscore-match-tv"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
124
142
  navigation(params?: OperationParamsMap["flashscore-navigation"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
125
143
  news(params?: OperationParamsMap["flashscore-news"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
126
144
  newsArticle(params: OperationParamsMap["flashscore-news-article"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
127
145
  newsCategories(params?: OperationParamsMap["flashscore-news-categories"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
146
+ oddsGeos(params?: OperationParamsMap["flashscore-odds-geos"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
147
+ player(params: OperationParamsMap["flashscore-player"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
148
+ playerInjuries(params: OperationParamsMap["flashscore-player-injuries"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
149
+ playerTransfers(params: OperationParamsMap["flashscore-player-transfers"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
128
150
  rankingCategories(params?: OperationParamsMap["flashscore-ranking-categories"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
129
151
  rankings(params: OperationParamsMap["flashscore-rankings"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
130
152
  scores(params: OperationParamsMap["flashscore-scores"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
131
153
  search(params: OperationParamsMap["flashscore-search"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
132
154
  sports(params?: OperationParamsMap["flashscore-sports"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
155
+ team(params: OperationParamsMap["flashscore-team"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
156
+ teamFixtures(params: OperationParamsMap["flashscore-team-fixtures"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
157
+ teamNews(params: OperationParamsMap["flashscore-team-news"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
158
+ teamResults(params: OperationParamsMap["flashscore-team-results"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
159
+ teamSquad(params: OperationParamsMap["flashscore-team-squad"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
160
+ teamTransfers(params: OperationParamsMap["flashscore-team-transfers"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
133
161
  topSearch(params?: OperationParamsMap["flashscore-top-search"], options?: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
134
162
  tournamentEvents(params: OperationParamsMap["flashscore-tournament-events"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
135
163
  tournamentSeasons(params: OperationParamsMap["flashscore-tournament-seasons"], options: CrawloraRequestOptions & { responseType: "text" }): Promise<string>;
@@ -147,18 +175,32 @@ export class FlashscoreClient extends CrawloraClient {
147
175
  matchHighlights(...args: OperationRequestArgs<"flashscore-match-highlights">): Promise<OperationResponseMap["flashscore-match-highlights"]>;
148
176
  matchInfo(...args: OperationRequestArgs<"flashscore-match-info">): Promise<OperationResponseMap["flashscore-match-info"]>;
149
177
  matchLineups(...args: OperationRequestArgs<"flashscore-match-lineups">): Promise<OperationResponseMap["flashscore-match-lineups"]>;
178
+ matchMissingPlayers(...args: OperationRequestArgs<"flashscore-match-missing-players">): Promise<OperationResponseMap["flashscore-match-missing-players"]>;
150
179
  matchNews(...args: OperationRequestArgs<"flashscore-match-news">): Promise<OperationResponseMap["flashscore-match-news"]>;
180
+ matchOdds(...args: OperationRequestArgs<"flashscore-match-odds">): Promise<OperationResponseMap["flashscore-match-odds"]>;
181
+ matchPredictedLineups(...args: OperationRequestArgs<"flashscore-match-predicted-lineups">): Promise<OperationResponseMap["flashscore-match-predicted-lineups"]>;
151
182
  matchStandings(...args: OperationRequestArgs<"flashscore-match-standings">): Promise<OperationResponseMap["flashscore-match-standings"]>;
152
183
  matchStats(...args: OperationRequestArgs<"flashscore-match-stats">): Promise<OperationResponseMap["flashscore-match-stats"]>;
184
+ matchTv(...args: OperationRequestArgs<"flashscore-match-tv">): Promise<OperationResponseMap["flashscore-match-tv"]>;
153
185
  navigation(...args: OperationRequestArgs<"flashscore-navigation">): Promise<OperationResponseMap["flashscore-navigation"]>;
154
186
  news(...args: OperationRequestArgs<"flashscore-news">): Promise<OperationResponseMap["flashscore-news"]>;
155
187
  newsArticle(...args: OperationRequestArgs<"flashscore-news-article">): Promise<OperationResponseMap["flashscore-news-article"]>;
156
188
  newsCategories(...args: OperationRequestArgs<"flashscore-news-categories">): Promise<OperationResponseMap["flashscore-news-categories"]>;
189
+ oddsGeos(...args: OperationRequestArgs<"flashscore-odds-geos">): Promise<OperationResponseMap["flashscore-odds-geos"]>;
190
+ player(...args: OperationRequestArgs<"flashscore-player">): Promise<OperationResponseMap["flashscore-player"]>;
191
+ playerInjuries(...args: OperationRequestArgs<"flashscore-player-injuries">): Promise<OperationResponseMap["flashscore-player-injuries"]>;
192
+ playerTransfers(...args: OperationRequestArgs<"flashscore-player-transfers">): Promise<OperationResponseMap["flashscore-player-transfers"]>;
157
193
  rankingCategories(...args: OperationRequestArgs<"flashscore-ranking-categories">): Promise<OperationResponseMap["flashscore-ranking-categories"]>;
158
194
  rankings(...args: OperationRequestArgs<"flashscore-rankings">): Promise<OperationResponseMap["flashscore-rankings"]>;
159
195
  scores(...args: OperationRequestArgs<"flashscore-scores">): Promise<OperationResponseMap["flashscore-scores"]>;
160
196
  search(...args: OperationRequestArgs<"flashscore-search">): Promise<OperationResponseMap["flashscore-search"]>;
161
197
  sports(...args: OperationRequestArgs<"flashscore-sports">): Promise<OperationResponseMap["flashscore-sports"]>;
198
+ team(...args: OperationRequestArgs<"flashscore-team">): Promise<OperationResponseMap["flashscore-team"]>;
199
+ teamFixtures(...args: OperationRequestArgs<"flashscore-team-fixtures">): Promise<OperationResponseMap["flashscore-team-fixtures"]>;
200
+ teamNews(...args: OperationRequestArgs<"flashscore-team-news">): Promise<OperationResponseMap["flashscore-team-news"]>;
201
+ teamResults(...args: OperationRequestArgs<"flashscore-team-results">): Promise<OperationResponseMap["flashscore-team-results"]>;
202
+ teamSquad(...args: OperationRequestArgs<"flashscore-team-squad">): Promise<OperationResponseMap["flashscore-team-squad"]>;
203
+ teamTransfers(...args: OperationRequestArgs<"flashscore-team-transfers">): Promise<OperationResponseMap["flashscore-team-transfers"]>;
162
204
  topSearch(...args: OperationRequestArgs<"flashscore-top-search">): Promise<OperationResponseMap["flashscore-top-search"]>;
163
205
  tournamentEvents(...args: OperationRequestArgs<"flashscore-tournament-events">): Promise<OperationResponseMap["flashscore-tournament-events"]>;
164
206
  tournamentSeasons(...args: OperationRequestArgs<"flashscore-tournament-seasons">): Promise<OperationResponseMap["flashscore-tournament-seasons"]>;
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.2" });
12
+ super({ ...options, userAgent: options.userAgent ?? "crawlora-flashscore-js/0.2.0" });
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);
@@ -17,18 +17,32 @@ export class FlashscoreClient extends CrawloraClient {
17
17
  this["matchHighlights"] = (...args) => this.request("flashscore-match-highlights", ...args);
18
18
  this["matchInfo"] = (...args) => this.request("flashscore-match-info", ...args);
19
19
  this["matchLineups"] = (...args) => this.request("flashscore-match-lineups", ...args);
20
+ this["matchMissingPlayers"] = (...args) => this.request("flashscore-match-missing-players", ...args);
20
21
  this["matchNews"] = (...args) => this.request("flashscore-match-news", ...args);
22
+ this["matchOdds"] = (...args) => this.request("flashscore-match-odds", ...args);
23
+ this["matchPredictedLineups"] = (...args) => this.request("flashscore-match-predicted-lineups", ...args);
21
24
  this["matchStandings"] = (...args) => this.request("flashscore-match-standings", ...args);
22
25
  this["matchStats"] = (...args) => this.request("flashscore-match-stats", ...args);
26
+ this["matchTv"] = (...args) => this.request("flashscore-match-tv", ...args);
23
27
  this["navigation"] = (...args) => this.request("flashscore-navigation", ...args);
24
28
  this["news"] = (...args) => this.request("flashscore-news", ...args);
25
29
  this["newsArticle"] = (...args) => this.request("flashscore-news-article", ...args);
26
30
  this["newsCategories"] = (...args) => this.request("flashscore-news-categories", ...args);
31
+ this["oddsGeos"] = (...args) => this.request("flashscore-odds-geos", ...args);
32
+ this["player"] = (...args) => this.request("flashscore-player", ...args);
33
+ this["playerInjuries"] = (...args) => this.request("flashscore-player-injuries", ...args);
34
+ this["playerTransfers"] = (...args) => this.request("flashscore-player-transfers", ...args);
27
35
  this["rankingCategories"] = (...args) => this.request("flashscore-ranking-categories", ...args);
28
36
  this["rankings"] = (...args) => this.request("flashscore-rankings", ...args);
29
37
  this["scores"] = (...args) => this.request("flashscore-scores", ...args);
30
38
  this["search"] = (...args) => this.request("flashscore-search", ...args);
31
39
  this["sports"] = (...args) => this.request("flashscore-sports", ...args);
40
+ this["team"] = (...args) => this.request("flashscore-team", ...args);
41
+ this["teamFixtures"] = (...args) => this.request("flashscore-team-fixtures", ...args);
42
+ this["teamNews"] = (...args) => this.request("flashscore-team-news", ...args);
43
+ this["teamResults"] = (...args) => this.request("flashscore-team-results", ...args);
44
+ this["teamSquad"] = (...args) => this.request("flashscore-team-squad", ...args);
45
+ this["teamTransfers"] = (...args) => this.request("flashscore-team-transfers", ...args);
32
46
  this["topSearch"] = (...args) => this.request("flashscore-top-search", ...args);
33
47
  this["tournamentEvents"] = (...args) => this.request("flashscore-tournament-events", ...args);
34
48
  this["tournamentSeasons"] = (...args) => this.request("flashscore-tournament-seasons", ...args);
@@ -46,5 +60,5 @@ export {
46
60
  CrawloraServerError
47
61
  };
48
62
  export { groups, operations, operationCount, OperationIds } from "./operations.js";
49
- export const VERSION = "0.1.2";
63
+ export const VERSION = "0.2.0";
50
64
  export default FlashscoreClient;