
Read HTML from Baseball Reference with retry on rate-limit (429)
Source:R/utils.R
bref_read_html.RdBaseball Reference rate-limits (HTTP 429) scrapers that make rapid
sequential requests. xml2::read_html() has no built-in retry, so a
429 surfaces as a generic error and the caller's tryCatch swallows it
into a misleading "Invalid arguments or no data available" message (#344).
This helper uses httr2::req_retry() to retry 429 / 503 responses
with exponential backoff (up to 3 tries), then passes the response
body to xml2::read_html(). A 5-second courtesy delay mirrors the
existing NCAA scraper convention.
Value
An XML document as returned by xml2::read_html().