Skip to content

betting_combat.providers.bestfightodds.client

client.py — BestFightOdds (bestfightodds.com): the MMA lines its pages show, read on the standard library only. robots.txt allows every path but /cnadm/ and sets no crawl-delay: one request every CRAWL_DELAY_S.

parse_sitemap the sitemap's events: path, BFO's event id, its day (the sitemap's lastmod)
parse_event an event page: its name and day, each fight (BFO's matchup id, side 1 and
side 2: names and pages), and every line the page shows, a book's price on a
side or on a prop (a past card's: its closing line). The page lists today's
books only: an old card's fights come without a book's line
parse_fighter a fighter page: every fight he had a line in, his side's and his opponent's
opening line and closing range (the lowest .. highest close across the books,
as decimal odds), and his side's line path (the page's sparkline: the line
from the open to the close, at most 10 points, no times)
The old pages (2008-2020, as the web archive keeps them) read the same way:
their books are the books of the time, each book's id in its link
decimal an American price as decimal odds ('EV' is +100)
BestFightOdds the provider: ``sitemap()`` the events, ``page(path)`` an event's or a
fighter's page (None: BFO does not know the path, it sends its home page)

The line-movement charts behind the pages (/api/ggd) are served scrambled: not read. A price is as the page prints it: the American line (the vig left in).

Classes

BestFightOdds

Bases: Provider

BestFightOdds’ pages, one request every CRAWL_DELAY_S.

page

page(path: str) -> str | None

/events/{x} or /fighters/{x}; None when BFO sends its home page instead (a path it does not know).

sitemap

sitemap() -> list[Listed]

Every event BFO lists.

EventLine

One book’s price on one side of a fight (prop None) or of one of its props (prop BFO’s prop type, team its number: 0 the fight’s, else the side it names).

EventPage

FighterLine

One fight on a fighter page: his side and his opponent’s lines as decimal odds (None: not shown), and his side’s path from the open to the close.

Listed

An event of the sitemap: its page (slug-id), BFO’s id, its day.

Side

One fighter as a page names him: his name, and his page’s path (slug-id).

Functions

decimal

decimal(american: str | int | None) -> float | None

American odds as decimal; None when not a price.

parse_event

parse_event(page: str) -> EventPage

An event page’s name, day, fights and lines (see the module doc).

parse_fighter

parse_fighter(page: str) -> list[FighterLine]

A fighter page’s fights (see the module doc).

parse_sitemap

parse_sitemap(xml: str) -> list[Listed]

Every event of sitemap-events.xml.