alexei.dolgolyov 004dbeae8b fix(scraping): live page lacks data-event-path and uses category sport IDs
Previously LiveEventsParser returned 0 events from /su/live because two
real differences between the live page and the pre-match listing weren't
handled:

1. Live rows omit data-event-path entirely. They expose only
   data-event-treeId, and the bookmaker routes live events under
   /su/live/<treeId> rather than /su/betting/<...>.

2. The closest data-sport-treeId ancestor on the live page is a
   category-tree wrapper (26418=Football-live, 45356=Basketball-live, …)
   instead of the canonical breadcrumb sport ID (11/6/22723/43658) the
   rest of the app uses. The pre-match listing carries the canonical
   ID directly.

Changes:

* EventListingParserBase.ParseRow: data-event-path becomes optional. For
  live rows we synthesize EventPath = "live/<treeId>" from
  data-event-treeId (validated as digits-only). Pre-match validation is
  unchanged.

* New ExtractSportCodeFromLive walks ancestors looking for a sport-tree
  ID and maps it through a small live-id → canonical-id table covering
  the four scoped sports. Out-of-scope sports (cybersport, volleyball,
  table tennis) are intentionally left unmapped — they keep their raw
  category ID and the UI renders them via SportLabels as "Sport <N>".

* MarathonbetScraper.ResolveEventDetailPath: dispatches between
  /su/live/<treeId> and /su/betting/<...> based on the EventPath prefix.
  Removes the duplicated path-building between ScrapeEventOddsAsync and
  ScrapeEventResultAsync.

* New regression tests covering all three behaviors against a real
  /su/live capture (16 events, 5 sport categories).

Also: rewrites the stale "Disabled until Phase 8" hint copy on the
Settings.Workers.ResultsPollerEnabled flag — Phase 8 shipped, so the
results poller is safe to enable.
2026-05-09 16:07:03 +03:00

maraphon-app

Sports betting odds analyzer for marathonbet.by.

Scrapes pre-match (/su) and live (/su/live) sports events, tracks coefficient changes over time, and detects anomalies — in particular the "odds-flip" pattern where the bookmaker freezes betting and then inverts underdog/favorite odds.

Tech stack

  • .NET 8 + C# 12
  • Blazor Hybrid — WPF shell hosting BlazorWebView (designed to migrate to ASP.NET Core Blazor Server with no UI rewrite)
  • EF Core + SQLite (WAL mode) for local storage
  • ClosedXML for Excel export
  • AngleSharp for HTML scraping (with Playwright fallback for JS-rendered pages)
  • Polly v8 for retry / circuit breaker / rate limiting
  • MudBlazor UI components, Plotly.Blazor for charts
  • Serilog structured logging
  • xUnit / FluentAssertions / NSubstitute for tests

Project layout

src/
  Marathon.Domain/         entities, value objects, no dependencies
  Marathon.Application/    use cases, abstractions (IOddsScraper, IRepository, ...)
  Marathon.Infrastructure/ EF Core, scraping, Polly, Excel, Playwright
  Marathon.UI/             Razor Class Library — all Blazor components live here
  Marathon.Hosts.WpfBlazor/ WPF + BlazorWebView host (replaceable for web)
tests/
  Marathon.*.Tests/        unit + integration tests per layer

Build & run

dotnet build Marathon.sln
dotnet test  Marathon.sln
dotnet run   --project src/Marathon.Hosts.WpfBlazor

Configuration

All variable parameters (polling intervals, concurrency, user-agents, retry policy, snapshot retention, locale) are exposed via appsettings.json and live-editable via the in-app Settings page.

Status

🟡 In active development. See plans/initial-implementation/PLAN.md for the current phase plan and progress.

License

Private — customer project.

S
Description
No description provided
Readme 1.8 MiB
Languages
HTML 54.3%
C# 45%
CSS 0.7%