football-docs 0.12.1 → 0.12.2

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.
Files changed (83) hide show
  1. package/README.md +10 -2
  2. package/data/docs.db +0 -0
  3. package/dist/crawl.d.ts +55 -0
  4. package/dist/crawl.js +231 -0
  5. package/dist/tools.js +27 -6
  6. package/docs/sportradar/api-access.md +10 -0
  7. package/docs/sportradar/api-endpoints.md +0 -14
  8. package/docs/sportradar/monitoring-data-changes.md +310 -0
  9. package/docs/sportradar/soccer-api-vs-soccer-extended-api.md +194 -0
  10. package/docs/sportradar/soccer-extended-competition-info.md +23 -0
  11. package/docs/sportradar/soccer-extended-competition-seasons.md +31 -0
  12. package/docs/sportradar/soccer-extended-competitions.md +39 -0
  13. package/docs/sportradar/soccer-extended-competitor-mappings.md +27 -0
  14. package/docs/sportradar/soccer-extended-competitor-merge-mappings.md +28 -0
  15. package/docs/sportradar/soccer-extended-competitor-profile.md +115 -0
  16. package/docs/sportradar/soccer-extended-competitor-schedules.md +219 -0
  17. package/docs/sportradar/soccer-extended-competitor-summaries.md +150 -0
  18. package/docs/sportradar/soccer-extended-competitor-vs-competitor.md +39 -0
  19. package/docs/sportradar/soccer-extended-daily-schedules.md +23 -0
  20. package/docs/sportradar/soccer-extended-daily-summaries.md +23 -0
  21. package/docs/sportradar/soccer-extended-faq.md +1332 -0
  22. package/docs/sportradar/soccer-extended-fifa-rankings.md +56 -0
  23. package/docs/sportradar/soccer-extended-league-timeline.md +116 -0
  24. package/docs/sportradar/soccer-extended-live-schedules.md +23 -0
  25. package/docs/sportradar/soccer-extended-live-summaries.md +23 -0
  26. package/docs/sportradar/soccer-extended-live-timelines-delta.md +58 -0
  27. package/docs/sportradar/soccer-extended-live-timelines.md +65 -0
  28. package/docs/sportradar/soccer-extended-overview.md +241 -0
  29. package/docs/sportradar/soccer-extended-player-mappings.md +27 -0
  30. package/docs/sportradar/soccer-extended-player-merge-mappings.md +28 -0
  31. package/docs/sportradar/soccer-extended-player-profile.md +64 -0
  32. package/docs/sportradar/soccer-extended-player-schedules.md +23 -0
  33. package/docs/sportradar/soccer-extended-player-summaries.md +23 -0
  34. package/docs/sportradar/soccer-extended-push-events.md +252 -0
  35. package/docs/sportradar/soccer-extended-push-feeds.md +129 -0
  36. package/docs/sportradar/soccer-extended-push-statistics.md +258 -0
  37. package/docs/sportradar/soccer-extended-season-competitors.md +34 -0
  38. package/docs/sportradar/soccer-extended-season-form-standings.md +59 -0
  39. package/docs/sportradar/soccer-extended-season-info.md +146 -0
  40. package/docs/sportradar/soccer-extended-season-leaders.md +46 -0
  41. package/docs/sportradar/soccer-extended-season-lineups.md +86 -0
  42. package/docs/sportradar/soccer-extended-season-links.md +53 -0
  43. package/docs/sportradar/soccer-extended-season-missing-players.md +45 -0
  44. package/docs/sportradar/soccer-extended-season-overunder-statistics.md +36 -0
  45. package/docs/sportradar/soccer-extended-season-players.md +34 -0
  46. package/docs/sportradar/soccer-extended-season-schedule.md +50 -0
  47. package/docs/sportradar/soccer-extended-season-standings.md +77 -0
  48. package/docs/sportradar/soccer-extended-season-summaries.md +23 -0
  49. package/docs/sportradar/soccer-extended-season-transfers.md +61 -0
  50. package/docs/sportradar/soccer-extended-season-venues.md +31 -0
  51. package/docs/sportradar/soccer-extended-seasonal-competitor-extended-stati.md +398 -0
  52. package/docs/sportradar/soccer-extended-seasonal-competitor-players.md +48 -0
  53. package/docs/sportradar/soccer-extended-seasonal-competitor-statistics.md +143 -0
  54. package/docs/sportradar/soccer-extended-seasons-disabled.md +44 -0
  55. package/docs/sportradar/soccer-extended-seasons.md +32 -0
  56. package/docs/sportradar/soccer-extended-sport-event-extended-summary.md +712 -0
  57. package/docs/sportradar/soccer-extended-sport-event-extended-timeline.md +126 -0
  58. package/docs/sportradar/soccer-extended-sport-event-fun-facts.md +26 -0
  59. package/docs/sportradar/soccer-extended-sport-event-insights.md +32 -0
  60. package/docs/sportradar/soccer-extended-sport-event-lineups.md +23 -0
  61. package/docs/sportradar/soccer-extended-sport-event-momentum.md +39 -0
  62. package/docs/sportradar/soccer-extended-sport-event-summary.md +23 -0
  63. package/docs/sportradar/soccer-extended-sport-event-timeline.md +71 -0
  64. package/docs/sportradar/soccer-extended-sport-events-created.md +28 -0
  65. package/docs/sportradar/soccer-extended-sport-events-removed.md +27 -0
  66. package/docs/sportradar/soccer-extended-sport-events-updated.md +28 -0
  67. package/docs/sportradar/soccer-ig-api-basics.md +248 -0
  68. package/docs/sportradar/soccer-ig-data-coverage-tiers.md +399 -0
  69. package/docs/sportradar/soccer-ig-fixtures.md +1193 -0
  70. package/docs/sportradar/soccer-ig-historical-data.md +596 -0
  71. package/docs/sportradar/soccer-ig-id-handling.md +991 -0
  72. package/docs/sportradar/soccer-ig-live-match-retrieval.md +1078 -0
  73. package/docs/sportradar/soccer-ig-match-status-workflow.md +777 -0
  74. package/docs/sportradar/soccer-ig-overview.md +30 -0
  75. package/docs/sportradar/soccer-ig-push.md +515 -0
  76. package/docs/sportradar/soccer-ig-rosters-lineups-transfers.md +1400 -0
  77. package/docs/sportradar/soccer-ig-scenarios.md +17 -0
  78. package/docs/sportradar/soccer-ig-seasonal-stats.md +798 -0
  79. package/docs/sportradar/soccer-ig-tracking-standings.md +725 -0
  80. package/docs/sportradar/soccer-ig-tracking-tournaments.md +408 -0
  81. package/docs/sportradar/soccer-ig-update-frequencies.md +1313 -0
  82. package/package.json +3 -2
  83. package/providers.json +24 -7
package/README.md CHANGED
@@ -124,7 +124,7 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
124
124
  | TransferRoom | 45 | api-access, api-endpoints, charting-availability, data-model, identity-surfaces, data-provenance |
125
125
  | Opta | 73 | event-types, qualifiers, coordinate-system, api-access, charting-game-state, charting-lineups, charting-passmaps, charting-set-pieces, charting-shot-placement, identity-surfaces, data-provenance |
126
126
  | FMDB Pro | 37 | api-access, api-endpoints, data-model, identity-surfaces, data-provenance |
127
- | Sportradar | 32 | api-access, api-endpoints, data-model, charting-and-stories, integration-notes, data-provenance |
127
+ | Sportradar | 480 | integration guide (API basics, coverage tiers, ID handling, match status, update frequencies, push, historical data), Soccer Extended v4 endpoint reference with data-point tables, FAQ, plus curated api-access, api-endpoints, data-model, charting-and-stories, integration-notes, data-provenance |
128
128
  | socceraction | 34 | SPADL format, VAEP, Expected Threat |
129
129
  | BeSoccer | 16 | api-access, api-endpoints, data-provenance |
130
130
  | Driblab | 32 | api-access, api-endpoints, data-model, data-provenance |
@@ -135,7 +135,7 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
135
135
  | Soccerdonna | 5 | identity-surfaces, data-provenance |
136
136
  | Transfermarkt | 5 | identity-surfaces, data-provenance |
137
137
 
138
- **2,407 searchable chunks** across 26 providers and tools.
138
+ **2,855 searchable chunks** across 26 providers and tools.
139
139
 
140
140
  ESPN coverage consists of curated, dated observations of ESPN-hosted soccer
141
141
  endpoints, checked for eng.1 and esp.1. These observations are not an official API
@@ -180,6 +180,12 @@ Reep's snapshots age weekly, as a new release is cut each week. Run
180
180
  `python3 scripts/check_reep_live.py` to check every download link and list what
181
181
  has changed since the snapshots; the refresh steps are in [specs/README.md](specs/README.md#reep).
182
182
 
183
+ `pnpm check:upstream` runs every upstream check in one report: pinned package
184
+ versions against PyPI, npm and GitHub, each spec snapshot against its public URL,
185
+ BeSoccer's and Driblab's truth regenerated from their Postman collection and Notion
186
+ page, and the free-source and Reep live checks below. It runs by hand, never in CI, and
187
+ lists what to review.
188
+
183
189
  Free sources have no spec, and they tend to fail quietly: a page still answers
184
190
  200 after the data has gone. Run `python3 scripts/check_free_sources_live.py` to
185
191
  request each access path documented in `docs/free-sources/` and check that the
@@ -230,6 +236,8 @@ Contributions are welcome from everyone. There are three ways to help:
230
236
 
231
237
  Provider doc sources are tracked in `providers.json`. The crawl pipeline discovers the best doc source (llms.txt > ReadTheDocs > GitHub README) and writes markdown with provenance frontmatter.
232
238
 
239
+ Two registry fields narrow a crawl. `llms_indexes` lists llms.txt files that link to pages rather than contain them; the crawler follows those links (and nested indexes) to each page's markdown copy instead of running discovery. Sportradar uses it for its integration guide and Soccer Extended reference. `exclude_categories` skips whole pages, and `exclude_sections` drops named `##`/`###` sections from pages that are otherwise kept, for content INCLUSION.md keeps out, such as odds. Pages crawled through an index are not byte-for-byte copies: the crawler drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts example payloads over 3 KB with a note, replaces a data-point table repeated from an earlier page with a line naming that page, and marks a split long section "(continued)". It adds no other text.
240
+
233
241
  ```bash
234
242
  npm run discover # probe sources without crawling
235
243
  npm run crawl # crawl all providers with sources
package/data/docs.db CHANGED
Binary file
package/dist/crawl.d.ts CHANGED
@@ -8,6 +8,14 @@
8
8
  * paraphrase, summarise, or interpret. The content in the output files should
9
9
  * be directly traceable to the source URL.
10
10
  *
11
+ * One exception, for pages reached through an llms.txt index (llms_indexes):
12
+ * the crawler removes markup and bulk, and marks each removal in the text.
13
+ * It drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts long
14
+ * example payloads with a note, replaces a data-point table repeated from an
15
+ * earlier page with a line naming that page, and repeats a heading with
16
+ * "(continued)" where it splits a long section. Every sentence that remains is
17
+ * the source's own.
18
+ *
11
19
  * Usage:
12
20
  * npm run crawl # crawl all providers with sources
13
21
  * npm run crawl -- --provider kloppy # crawl one provider
@@ -37,5 +45,52 @@ export declare function applyCategoryExclusions<T extends {
37
45
  * Already structured for LLM consumption — chunk by top-level heading.
38
46
  */
39
47
  export declare function crawlLlmsTxt(content: string, sourceUrl: string): CrawledDoc[];
48
+ /**
49
+ * Read the links out of an llms.txt index. Page links point at a page's
50
+ * markdown copy (`.md`); index links point at a further `llms.txt`. Links to
51
+ * another host are ignored, so an index cannot send the crawl off-site.
52
+ */
53
+ export declare function parseLlmsIndex(content: string, indexUrl: string): {
54
+ pages: string[];
55
+ indexes: string[];
56
+ };
57
+ /** The category a page is stored under: the last path segment, without `.md`. */
58
+ export declare function llmsPageCategory(pageUrl: string): string;
59
+ /**
60
+ * Turn a ReadMe-hosted page's markdown copy into plain markdown.
61
+ *
62
+ * ReadMe appends the endpoint's full OpenAPI definition to every reference page;
63
+ * the spec is mirrored separately (specs/), so everything from that heading on is
64
+ * dropped. Accordions become `###` headings, because their titles are where one
65
+ * data-point table ends and the next begins. Other MDX components and list markup
66
+ * are unwrapped to their text. Long example payloads are cut to their opening.
67
+ */
68
+ export declare function cleanLlmsPage(text: string): string;
69
+ /**
70
+ * Split any `##`/`###` section longer than `max` at paragraph breaks, repeating
71
+ * its heading with "(continued)" so each piece is still a searchable section.
72
+ */
73
+ export declare function splitOversizedSections(text: string, max?: number): string;
74
+ /**
75
+ * Reference pages repeat the same data-point tables (the competition, the
76
+ * season, the venue) on every endpoint that returns them. Keep the first copy
77
+ * of each `###` section and replace later identical copies with one line per
78
+ * page naming where the table is.
79
+ */
80
+ export declare function dedupeSharedSections<T extends {
81
+ category: string;
82
+ content: string;
83
+ }>(docs: T[]): T[];
84
+ /**
85
+ * Drop each `##`/`###` section whose heading is listed, with any deeper
86
+ * sections nested under it. Headings match case-insensitively.
87
+ */
88
+ export declare function dropSections(text: string, headings: string[] | undefined): string;
89
+ /**
90
+ * Crawl the pages listed by one or more llms.txt indexes, following nested
91
+ * indexes. Excluded categories are skipped before they are fetched, and
92
+ * excluded sections are dropped from the pages that are kept.
93
+ */
94
+ export declare function crawlLlmsIndexes(indexUrls: string[], excluded: string[] | undefined, fetcher?: (url: string) => Promise<string | null>, pauseMs?: number, excludedSections?: string[]): Promise<CrawledDoc[]>;
40
95
  export declare function slugify(text: string): string;
41
96
  export {};
package/dist/crawl.js CHANGED
@@ -8,6 +8,14 @@
8
8
  * paraphrase, summarise, or interpret. The content in the output files should
9
9
  * be directly traceable to the source URL.
10
10
  *
11
+ * One exception, for pages reached through an llms.txt index (llms_indexes):
12
+ * the crawler removes markup and bulk, and marks each removal in the text.
13
+ * It drops the OpenAPI definition ReadMe appends and SVG diagrams, cuts long
14
+ * example payloads with a note, replaces a data-point table repeated from an
15
+ * earlier page with a line naming that page, and repeats a heading with
16
+ * "(continued)" where it splits a long section. Every sentence that remains is
17
+ * the source's own.
18
+ *
11
19
  * Usage:
12
20
  * npm run crawl # crawl all providers with sources
13
21
  * npm run crawl -- --provider kloppy # crawl one provider
@@ -336,6 +344,215 @@ export function crawlLlmsTxt(content, sourceUrl) {
336
344
  }
337
345
  return sections;
338
346
  }
347
+ // ── llms.txt indexes ────────────────────────────────────────────────
348
+ /** Most pages a single llms.txt index crawl will fetch. */
349
+ const LLMS_INDEX_MAX_PAGES = 200;
350
+ /** A code fence longer than this is cut, with a note of how much was dropped. */
351
+ const MAX_FENCE_CHARS = 3000;
352
+ /** A section longer than this is split, so no chunk swamps an agent's context. */
353
+ const MAX_SECTION_CHARS = 30000;
354
+ /** A repeated section shorter than this is left in place; it costs little. */
355
+ const MIN_SHARED_SECTION_CHARS = 300;
356
+ /**
357
+ * Read the links out of an llms.txt index. Page links point at a page's
358
+ * markdown copy (`.md`); index links point at a further `llms.txt`. Links to
359
+ * another host are ignored, so an index cannot send the crawl off-site.
360
+ */
361
+ export function parseLlmsIndex(content, indexUrl) {
362
+ const host = new URL(indexUrl).hostname;
363
+ const pages = [];
364
+ const indexes = [];
365
+ for (const match of content.matchAll(/\]\((https?:\/\/[^)\s]+)\)/g)) {
366
+ let url;
367
+ try {
368
+ url = new URL(match[1]);
369
+ }
370
+ catch {
371
+ continue;
372
+ }
373
+ if (url.hostname !== host)
374
+ continue;
375
+ url.hash = "";
376
+ if (url.pathname.endsWith("/llms.txt"))
377
+ indexes.push(url.href);
378
+ else if (url.pathname.endsWith(".md"))
379
+ pages.push(url.href);
380
+ }
381
+ return { pages: [...new Set(pages)], indexes: [...new Set(indexes)] };
382
+ }
383
+ /** The category a page is stored under: the last path segment, without `.md`. */
384
+ export function llmsPageCategory(pageUrl) {
385
+ const segment = new URL(pageUrl).pathname.split("/").pop() ?? "";
386
+ return slugify(segment.replace(/\.md$/, ""));
387
+ }
388
+ /**
389
+ * Turn a ReadMe-hosted page's markdown copy into plain markdown.
390
+ *
391
+ * ReadMe appends the endpoint's full OpenAPI definition to every reference page;
392
+ * the spec is mirrored separately (specs/), so everything from that heading on is
393
+ * dropped. Accordions become `###` headings, because their titles are where one
394
+ * data-point table ends and the next begins. Other MDX components and list markup
395
+ * are unwrapped to their text. Long example payloads are cut to their opening.
396
+ */
397
+ export function cleanLlmsPage(text) {
398
+ let out = text.replace(/^---\n[\s\S]*?\n---\n/, "");
399
+ out = out.split(/\n# OpenAPI definition\b/)[0];
400
+ out = out.replace(/^Fetch the complete documentation index.*\n/m, "");
401
+ out = out.replace(/<HTMLBlock>\{`([\s\S]*?)`\}<\/HTMLBlock>/g, (_m, html) => html.includes("<svg")
402
+ ? "_(Diagram omitted: see the source page.)_"
403
+ : html.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim());
404
+ out = out.replace(/<Accordion\b[^>]*\btitle="([^"]+)"[^>]*>/g, (_m, title) => `### ${title}`);
405
+ out = out.replace(/<li\b[^>]*>([\s\S]*?)<\/li>/g, (_m, item) => `- ${item.replace(/<[^>]+>/g, "").trim()}`);
406
+ out = out.replace(/<\/?(?:AccordionGroup|Accordion|Callout|Tabs|Tab|Cards|Card|Columns|Column|Anchor|Image|Embed|Recipe|Glossary|div|ul|ol|span)\b[^>]*>/g, "");
407
+ out = out.replace(/\n[ \t]+- /g, "\n- ");
408
+ out = out.replace(/```(\w*)\n[\s\S]*?\n```/g, (fence, lang) => {
409
+ if (fence.length <= MAX_FENCE_CHARS)
410
+ return fence;
411
+ const kept = fence.slice(lang.length + 4, MAX_FENCE_CHARS).trimEnd();
412
+ const kb = Math.round(fence.length / 1024);
413
+ return `\`\`\`${lang}\n${kept}\n... (example cut here; ${kb} KB in the source page)\n\`\`\``;
414
+ });
415
+ return `${out.replace(/\n{3,}/g, "\n\n").trim()}\n`;
416
+ }
417
+ /**
418
+ * Split any `##`/`###` section longer than `max` at paragraph breaks, repeating
419
+ * its heading with "(continued)" so each piece is still a searchable section.
420
+ */
421
+ export function splitOversizedSections(text, max = MAX_SECTION_CHARS) {
422
+ const sections = text.split(/(?=^#{2,3} )/m);
423
+ return sections
424
+ .map((section) => {
425
+ if (section.length <= max)
426
+ return section;
427
+ const heading = section.match(/^(#{2,3}) (.+)\n/);
428
+ const level = heading?.[1] ?? "###";
429
+ const title = heading?.[2] ?? "Section";
430
+ const pieces = [];
431
+ let current = "";
432
+ for (const paragraph of section.split(/\n\n/)) {
433
+ const insideFence = (current.match(/^```/gm)?.length ?? 0) % 2 === 1;
434
+ if (current && !insideFence && current.length + paragraph.length > max) {
435
+ pieces.push(current);
436
+ current = `${level} ${title} (continued)\n\n`;
437
+ }
438
+ current += `${paragraph}\n\n`;
439
+ }
440
+ pieces.push(current);
441
+ return pieces.join("");
442
+ })
443
+ .join("");
444
+ }
445
+ /**
446
+ * Reference pages repeat the same data-point tables (the competition, the
447
+ * season, the venue) on every endpoint that returns them. Keep the first copy
448
+ * of each `###` section and replace later identical copies with one line per
449
+ * page naming where the table is.
450
+ */
451
+ export function dedupeSharedSections(docs) {
452
+ const firstSeen = new Map();
453
+ return docs.map((doc) => {
454
+ const kept = [];
455
+ const shared = [];
456
+ for (const section of doc.content.split(/(?=^#{2,3} )/m)) {
457
+ const heading = section.match(/^### (.+)\n/);
458
+ if (heading) {
459
+ const body = section.slice(heading[0].length).replace(/\s+/g, " ").trim();
460
+ const key = `${heading[1]}\u0000${body}`;
461
+ const owner = firstSeen.get(key);
462
+ if (body.length >= MIN_SHARED_SECTION_CHARS && owner && owner !== doc.category) {
463
+ shared.push(`${heading[1]} (\`${owner}\`)`);
464
+ continue;
465
+ }
466
+ if (!owner)
467
+ firstSeen.set(key, doc.category);
468
+ }
469
+ kept.push(section);
470
+ }
471
+ let content = kept.join("").trimEnd();
472
+ if (shared.length > 0) {
473
+ content += `\n\nAlso returns these data points, documented on the page named in brackets: ${shared.join(", ")}.`;
474
+ }
475
+ return { ...doc, content: `${content}\n` };
476
+ });
477
+ }
478
+ /**
479
+ * Drop each `##`/`###` section whose heading is listed, with any deeper
480
+ * sections nested under it. Headings match case-insensitively.
481
+ */
482
+ export function dropSections(text, headings) {
483
+ if (!headings?.length)
484
+ return text;
485
+ const drop = new Set(headings.map((h) => h.trim().toLowerCase()));
486
+ const kept = [];
487
+ let droppingLevel = 0;
488
+ let fenced = false;
489
+ for (const line of text.split("\n")) {
490
+ if (/^ {0,3}(`{3,}|~{3,})/.test(line))
491
+ fenced = !fenced;
492
+ const heading = fenced ? null : line.match(/^(#{2,3}) (.+?)\s*$/);
493
+ if (heading) {
494
+ const level = heading[1].length;
495
+ if (droppingLevel && level <= droppingLevel)
496
+ droppingLevel = 0;
497
+ if (!droppingLevel && drop.has(heading[2].toLowerCase()))
498
+ droppingLevel = level;
499
+ }
500
+ if (!droppingLevel)
501
+ kept.push(line);
502
+ }
503
+ return kept.join("\n");
504
+ }
505
+ /**
506
+ * Crawl the pages listed by one or more llms.txt indexes, following nested
507
+ * indexes. Excluded categories are skipped before they are fetched, and
508
+ * excluded sections are dropped from the pages that are kept.
509
+ */
510
+ export async function crawlLlmsIndexes(indexUrls, excluded, fetcher = fetchText, pauseMs = 250, excludedSections) {
511
+ const skip = new Set(excluded ?? []);
512
+ const pageUrls = [];
513
+ const queue = [...indexUrls];
514
+ const visited = new Set();
515
+ while (queue.length > 0) {
516
+ const indexUrl = queue.shift();
517
+ if (visited.has(indexUrl))
518
+ continue;
519
+ visited.add(indexUrl);
520
+ const content = await fetcher(indexUrl);
521
+ if (!content)
522
+ continue;
523
+ const { pages, indexes } = parseLlmsIndex(content, indexUrl);
524
+ pageUrls.push(...pages);
525
+ queue.push(...indexes);
526
+ }
527
+ const docs = [];
528
+ const categories = new Set();
529
+ for (const pageUrl of [...new Set(pageUrls)]) {
530
+ if (docs.length >= LLMS_INDEX_MAX_PAGES)
531
+ break;
532
+ const category = llmsPageCategory(pageUrl);
533
+ if (!category || skip.has(category) || categories.has(category))
534
+ continue;
535
+ if (pauseMs > 0)
536
+ await new Promise((done) => setTimeout(done, pauseMs));
537
+ const markdown = await fetcher(pageUrl);
538
+ if (!markdown)
539
+ continue;
540
+ const content = dropSections(cleanLlmsPage(markdown), excludedSections);
541
+ if (content.length < 100)
542
+ continue;
543
+ categories.add(category);
544
+ docs.push({
545
+ category,
546
+ content,
547
+ source_url: pageUrl.replace(/\.md$/, ""),
548
+ source_type: "llms_txt",
549
+ });
550
+ }
551
+ return dedupeSharedSections(docs).map((doc) => ({
552
+ ...doc,
553
+ content: splitOversizedSections(doc.content),
554
+ }));
555
+ }
339
556
  /**
340
557
  * Crawl a documentation website by fetching linked pages from the index.
341
558
  * Works with Sphinx/RTD, MkDocs, GitBook HTML, Docusaurus, and most
@@ -617,6 +834,20 @@ async function main() {
617
834
  for (const [name, config] of Object.entries(targets)) {
618
835
  if (!config)
619
836
  continue;
837
+ if (config.llms_indexes?.length) {
838
+ console.log(`\n${name}: following ${config.llms_indexes.length} llms.txt index(es)`);
839
+ for (const url of config.llms_indexes)
840
+ console.log(` ${url}`);
841
+ if (discoverOnly)
842
+ continue;
843
+ const docs = await crawlLlmsIndexes(config.llms_indexes, config.exclude_categories, fetchText, 250, config.exclude_sections);
844
+ for (const doc of docs) {
845
+ writeCrawledDoc(name, doc, config.version);
846
+ console.log(` wrote ${name}/${doc.category}.md (${doc.content.length} chars) [${doc.source_type}]`);
847
+ }
848
+ console.log(` → ${docs.length} doc(s) written`);
849
+ continue;
850
+ }
620
851
  const sources = config.sources
621
852
  .filter((s) => !!s.url)
622
853
  .map((s) => ({
package/dist/tools.js CHANGED
@@ -181,6 +181,27 @@ function searchRows(db, matchQuery, provider, limit) {
181
181
  params.push(limit);
182
182
  return db.prepare(sql).all(...params);
183
183
  }
184
+ /**
185
+ * The strict query needs every term to match, so it finds the most specific
186
+ * chunks but can find very few. Keep its matches first, then fill the remaining
187
+ * slots from the relaxed query, skipping chunks already listed. Returning only
188
+ * the strict matches let one chunk that happened to contain every term crowd
189
+ * out the rest of the answer.
190
+ */
191
+ function topUpRows(strict, relaxed, limit) {
192
+ const key = (row) => `${row.provider}\u0000${row.category}\u0000${row.title}\u0000${row.content}`;
193
+ const seen = new Set(strict.map(key));
194
+ const rows = [...strict];
195
+ for (const row of relaxed) {
196
+ if (rows.length >= limit)
197
+ break;
198
+ if (seen.has(key(row)))
199
+ continue;
200
+ seen.add(key(row));
201
+ rows.push(row);
202
+ }
203
+ return rows;
204
+ }
184
205
  function compareRows(db, matchQuery, providers) {
185
206
  let sql = `
186
207
  SELECT d.provider, d.category, d.title, d.content,
@@ -327,8 +348,8 @@ export function getProviderDocs(db, args) {
327
348
  const strictQuery = args.topic ? sanitiseFtsQuery(args.topic) : undefined;
328
349
  const fallbackQuery = args.topic ? relaxedFtsQuery(args.topic) : undefined;
329
350
  let rows = providerDocsRows(db, provider, strictQuery, category, limit);
330
- if (rows.length === 0 && fallbackQuery && fallbackQuery !== strictQuery) {
331
- rows = providerDocsRows(db, provider, fallbackQuery, category, limit);
351
+ if (rows.length < limit && fallbackQuery && fallbackQuery !== strictQuery) {
352
+ rows = topUpRows(rows, providerDocsRows(db, provider, fallbackQuery, category, limit), limit);
332
353
  }
333
354
  if (rows.length === 0) {
334
355
  return textResult(`No provider docs found for "${providerFilterLabel(args.provider, provider)}"${category ? ` in category "${category}"` : ""}${args.topic ? ` matching "${args.topic}"` : ""}. Call resolve_provider_id or list_providers to inspect available coverage.`);
@@ -353,8 +374,8 @@ export function searchDocs(db, args) {
353
374
  }
354
375
  }
355
376
  let rows = searchRows(db, strictQuery, provider, limit);
356
- if (rows.length === 0 && fallbackQuery !== strictQuery) {
357
- rows = searchRows(db, fallbackQuery, provider, limit);
377
+ if (rows.length < limit && fallbackQuery !== strictQuery) {
378
+ rows = topUpRows(rows, searchRows(db, fallbackQuery, provider, limit), limit);
358
379
  }
359
380
  if (rows.length === 0) {
360
381
  const providerLabel = providerFilterLabel(args.provider, provider);
@@ -403,9 +424,9 @@ export function compareProviders(db, args) {
403
424
  if (!providerSet.has(provider))
404
425
  return [];
405
426
  const strictRows = compareRowsForProvider(db, strictQuery, provider, 3);
406
- if (strictRows.length > 0 || fallbackQuery === strictQuery)
427
+ if (strictRows.length >= 3 || fallbackQuery === strictQuery)
407
428
  return strictRows;
408
- return compareRowsForProvider(db, fallbackQuery, provider, 3);
429
+ return topUpRows(strictRows, compareRowsForProvider(db, fallbackQuery, provider, 3), 3);
409
430
  });
410
431
  }
411
432
  else {
@@ -20,6 +20,16 @@ current soccer product is v4, with two closely related surfaces:
20
20
  Responses can be requested as JSON or XML. Data availability depends on
21
21
  competition coverage tier and the customer's subscription package.
22
22
 
23
+ The endpoint reference in this index is Sportradar's Soccer Extended v4 reference
24
+ (`soccer-extended-*` categories). Soccer v4 serves the same feeds under the
25
+ `/soccer/` base in place of `/soccer-extended/`, without the extended statistics,
26
+ coordinates and Extended-only feeds (extended summary and timeline, insights,
27
+ momentum, seasonal competitor extended statistics). The Soccer v4 reference also
28
+ documents a few fields the Extended reference lacks, such as
29
+ `stoppage_time_announced`, `stoppage_time_played` and `played` in the match
30
+ summary, so check https://developer.sportradar.com/soccer/reference/soccer-overview
31
+ before concluding a field does not exist.
32
+
23
33
  ## Authentication
24
34
 
25
35
  Requests use Sportradar API credentials configured in the customer's account.
@@ -76,17 +76,3 @@ or season-specific endpoints.
76
76
  | Live Timelines Delta | ten-second live delta with scoring and timeline changes |
77
77
  | Push Events | real-time event updates for live matches |
78
78
  | Push Statistics | real-time team and player match-level statistics |
79
-
80
- ## Probabilities
81
-
82
- Probability endpoints are part of an additional Soccer Extended probabilities
83
- plan. They cover pre-match, live, timeline, season, and outright probabilities.
84
-
85
- | Feed | Purpose |
86
- |---|---|
87
- | Live Probabilities | live match probability state |
88
- | Sport Event Probabilities | pre-match and live probabilities for a match |
89
- | Timeline Probabilities | probability changes through the match timeline |
90
- | Season Probabilities | home/draw/away probabilities for all matches in a season |
91
- | Season Outright Probabilities | outright probabilities for season competitors |
92
-