# Equibase US Horse Racing Scraper (`memo23/equibase-us-horse-racing-scraper`) Actor

Scrape US Thoroughbred horse racing data from Equibase.com — the official source for North American racing. Extract race entries (horses, jockeys, trainers, odds) and results (finish order, times, payouts) for any date and track.

- **URL**: https://apify.com/memo23/equibase-us-horse-racing-scraper.md
- **Developed by:** [Muhamed Didovic](https://apify.com/memo23) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Equibase US Horse Racing Scraper

Scrape US Thoroughbred horse racing data from Equibase.com — the official source for North American racing information. Extract race entries (horses, jockeys, trainers, morning line odds) and results (finish order, payouts, winning times) for any date and track.

### How it works

Equibase serves all race data as pre-rendered static HTML files. The site is protected by Imperva/Incapsula bot detection, which blocks plain HTTP requests. This actor uses a two-step approach:

1. **Cookie extraction**: A headless Chromium browser visits the site, solves the Imperva JS challenge, and extracts the session cookies.
2. **Static HTML scraping**: The cookies are reused to fetch the race pages via plain HTTP. The HTML is parsed with Cheerio to extract structured data.

No API calls, no JavaScript rendering needed for the data itself — just static HTML files with clean, parseable content.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `raceDate` | string | Date to scrape in MM/DD/YYYY format. Use today/future for entries, past for results. |
| `trackCodes` | array | Optional track codes to filter (e.g. BEL, CD, SA, GP). Empty = all tracks. |
| `dataMode` | select | `entries`, `results`, or `both` (default: `both`) |
| `maxItems` | integer | Max records to push (default: 100) |
| `maxRaces` | integer | Max races per track. 0 = all (default: 0) |

### Output

#### Entries (pre-race)

Each record is a horse in a race:

- `raceDate`, `track`, `raceNumber` — race identification
- `raceType`, `purse`, `distance`, `surface`, `postTime`, `starters` — race metadata
- `programNumber`, `postPosition` — horse position
- `horse`, `horseState`, `ageSex`, `medication` — horse details
- `jockey`, `weight`, `trainer` — connections
- `morningLineOdds` — morning line
- `owners`, `breeders`, `pedigree`, `equipmentChanges` — extra info

#### Results (post-race)

Each record is a finisher in a race:

- `raceDate`, `track`, `raceNumber` — race identification
- `raceType`, `purse`, `distance`, `trackCondition`, `winningTime` — race metadata
- `ageRestriction`, `sexRestriction`, `offTime` — race conditions
- `finishPosition`, `programNumber`, `horse`, `jockey` — finish order
- `winPayoff`, `placePayoff`, `showPayoff` — payouts
- `alsoRan`, `scratches` — non-finishers
- `wagers` — exacta, trifecta, superfecta payoffs
- `winningBreeder`, `winningOwner`, `winningTrainer`, `winningSire` — winning connections

### Track codes

Common US Thoroughbred track codes: BEL (Belmont Park), CD (Churchill Downs), SA (Santa Anita), GP (Gulfstream Park), AQU (Aqueduct), SAR (Saratoga), DMR (Del Mar), TLS (Turf Paradise), PRX (Parx), MTH (Monmouth), DEL (Delaware Park), KEE (Keeneland), TAM (Tampa Bay), WO (Woodbine), and more.

### URL patterns

The actor constructs URLs following these patterns:

```
Entries race card: /static/entry/RaceCardIndex{TRACK}{MMDDYY}{COUNTRY}-EQB.html
Entries race:      /static/entry/{TRACK}{MMDDYY}{COUNTRY}{RACENUM}-EQB.html
Results race card: /static/chart/summary/RaceCardIndex{TRACK}{MMDDYY}{COUNTRY}-EQB.html
Results race:      /static/chart/summary/{TRACK}{MMDDYY}{COUNTRY}{RACENUM}-EQB.html
```

# Actor input Schema

## `raceDate` (type: `string`):

Date to scrape in MM/DD/YYYY format. Use today or a future date for entries; a past date for results. Leave empty to default to today.

## `trackCodes` (type: `array`):

Optional list of track codes to filter (e.g. BEL, CD, SA, GP, AQU). Leave empty to scrape all tracks running on the selected date.

## `dataMode` (type: `string`):

entries = race cards (horses, jockeys, trainers, odds); results = finish order + payouts; both = entries and results (results only available for past races).

## `maxItems` (type: `integer`):

Maximum number of records (horses for entries, finishers for results) to push to the dataset.

## `maxRaces` (type: `integer`):

Maximum number of races to scrape per track. 0 = all races on the card.

## `proxy` (type: `object`):

Optionally override the default proxy configuration.

## Actor input object example

```json
{
  "trackCodes": [],
  "dataMode": "both",
  "maxItems": 100,
  "proxy": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

One row per horse (entries mode) or per finisher (results mode). Entries include horse, jockey, trainer, morning line odds, owners, breeders, pedigree. Results include finish position, payouts, winning time, wagers, winning connections.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "raceDate": "",
    "trackCodes": [],
    "dataMode": "both",
    "maxItems": 100,
    "maxRaces": 0,
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("memo23/equibase-us-horse-racing-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "raceDate": "",
    "trackCodes": [],
    "dataMode": "both",
    "maxItems": 100,
    "maxRaces": 0,
    "proxy": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("memo23/equibase-us-horse-racing-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "raceDate": "",
  "trackCodes": [],
  "dataMode": "both",
  "maxItems": 100,
  "maxRaces": 0,
  "proxy": {
    "useApifyProxy": true
  }
}' |
apify call memo23/equibase-us-horse-racing-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,memo23/equibase-us-horse-racing-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VtBIrlfrk5xZUfSBN/builds/ZC2zaE2HBHatq6fQH/openapi.json
