MLB Stats Scraper — Standings, Scores, Teams & Players avatar

MLB Stats Scraper — Standings, Scores, Teams & Players

Pricing

from $1.50 / 1,000 results

Go to Apify Store
MLB Stats Scraper — Standings, Scores, Teams & Players

MLB Stats Scraper — Standings, Scores, Teams & Players

Scrape MLB (Major League Baseball) data: league standings, all 30 teams, live game scores, and player rosters with season hitting & pitching stats. Pick a data type, set a season or date range, and export clean baseball stats as JSON, CSV or Excel for analytics, betting, fantasy and apps.

Pricing

from $1.50 / 1,000 results

Rating

0.0

(0)

Developer

Haketa

Haketa

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

15 days ago

Last modified

Features

Limited permissions

Share

MLB Stats Scraper — Baseball Standings, Scores, Players & Teams

Apify Actor Maintenance Data Format Zero Duplicate Coverage

Transform Major League Baseball data into clean, structured records without manual browser operations, private feeds, or complex data formatting. Choose between league standings, all 30 MLB team rosters, game scores & box scores by date, or player rosters with full season hitting and pitching stats. Retrieve complete historical or live baseball records across any season or date range.

Export verified datasets to JSON, CSV, Excel, or consume live feeds directly via the Apify REST API.

Built for sports betting modelers, fantasy baseball platforms, sports analysts, journalists, app developers, and statistical researchers who require clean, reliable Major League Baseball data on demand.


⚡ At a glance

FeatureSpecification
Target PlatformMajor League Baseball (MLB Official Stats)
Data TypesLeague Standings, 30 Team Records, Game Box Scores, Player Rosters & Stats
Coverage ScopeAll 30 MLB Clubs (American & National Leagues, 6 Divisions)
Temporal RangeHistorical seasons (1876–present) & real-time live season tracking
Throughput SpeedStandings & Teams: < 3s; Full league rosters with stats: ~7–12s
DeduplicationStrict natural key deduplication on gamePk, teamId, and playerId
Output FormatsJSON, CSV, XML, Excel (XLSX), HTML Table
Default Concurrency6 parallel roster hydration workers (configurable up to 12)
Proxy CompatibilityDatacenter or Residential proxy support with automatic retries

🔎 Why scrape MLB stats?

Major League Baseball produces one of the most comprehensive statistical archives in global sports: 30 franchises, 2,430 regular-season games annually, hundreds of active prospects, and continuous streams of box scores, split records, and Statcast metrics. This dataset serves as the foundational layer for algorithmic sports betting, DFS lineups, fantasy platforms, and predictive econometric modeling.

Collecting MLB data manually or via unstructured HTML scraping introduces severe formatting bugs: rate metrics parse into inconsistent decimals, doubleheaders produce duplicate records, and suspended games distort seasonal win-loss records. This MLB stats scraper solves the pipeline challenge: delivering normalized records with typed counting statistics, standardized rate metrics, and verified natural keys.

Primary enterprise use cases

  • Sports Betting & Predictive Analytics: Build automated betting models leveraging division standings, home/away splits, streak indices, and run differential metrics.
  • Daily Fantasy Sports (DFS) & Season-Long Fantasy: Feed real-time roster updates, batting splits, and pitching rotations into draft valuation algorithms.
  • Live Sports Dashboards & Bots: Power Discord bots, mobile sports notifications, and web dashboards with automatic daily game scores and division rankings.
  • Historical Sabermetric Research: Aggregate multi-year team records and player performances to study park factors, defensive shifts, and player aging curves.
  • Media & Sports Journalism Automation: Produce automated post-game write-ups, series recaps, and weekly divisional leaderboards.

✨ Core capabilities

  • 🏆 Standings: Complete division and league tables including wins, losses, win percentage, games back, division/league ranks, streaks, run differential, split records (home/away/L10), and postseason clinch indicators.
  • ⚾ Team Directories: Profiles for all 30 MLB franchises with legal club names, three-letter abbreviations, division affiliations, home venues, and inaugural seasons.
  • 📊 Game Scores & Schedules: Date-specific or multi-week game results capturing home and away teams, final scores, winning teams, series context, and venue metadata—deduplicated by gamePk.
  • 🧢 Player Profiles & Biometrics: Roster listings containing player bio fields (height, weight, bat/throw hand, birth city, age, MLB debut) alongside full season hitting and pitching numbers.
  • ✅ Parallel Team Roster Fan-out: Fans across all 30 teams in parallel (maxConcurrency), extracting 780–1,200 player records in roughly 8 seconds.
  • ✅ Dual-Discipline Stat Hydration: Captures counting and rate stats (AVG, HR, RBI, OPS, OBP, SLG, ERA, WHIP, SO, IP, saves) with clean string formatting (.293, 2.19).
  • ✅ Multi-Season Flexibility: Query the active season or back-fill historical seasons dating back to early baseball history.
  • ✅ Clean Export Standards: Export directly to JSON, CSV, Excel (XLSX), or connect downstream tools via Apify webhooks.

📥 Input parameters

Select a single dataType per execution and specify relevant season or date filters. All fields are optional; running without input extracts current-season league standings.

ParameterTypeDefaultDescription
dataTypeSelect"standings"Target dataset: standings, teams, scores, or players.
seasonIntegerCurrent YearTarget season year for standings, teams, and player stats.
dateString""Single game date for scores mode in YYYY-MM-DD format.
startDateString""Beginning of date range for scores mode (YYYY-MM-DD).
endDateString""Ending of date range for scores mode (YYYY-MM-DD).
teamIdsArray of Strings[]Limit players extraction to specific team IDs (e.g. ["147", "119"]).
includePlayerStatsBooleantrueHydrates player records with hitting and pitching season stats.
rosterTypeSelect"active"Roster depth: active, 40Man, fullSeason, or fullRoster.
maxItemsInteger100Maximum records to retain across the execution. Set to 0 for unlimited.
maxConcurrencyInteger6Parallel worker count for roster extraction (1–12).
proxyConfigurationObject{ "useApifyProxy": true }Apify Proxy configuration.

📋 Ready-to-use input examples

Example 1: Full league standings

{
"dataType": "standings",
"season": 2026,
"maxItems": 30
}

Example 2: Player rosters with season hitting & pitching stats

{
"dataType": "players",
"season": 2026,
"rosterType": "active",
"includePlayerStats": true,
"maxItems": 800,
"maxConcurrency": 8
}

Example 3: Game scores across a weekend date range

{
"dataType": "scores",
"startDate": "2026-08-14",
"endDate": "2026-08-16",
"maxItems": 100
}

📤 Output dataset structure

🧢 Player record output

{
"recordType": "player",
"playerId": 669257,
"fullName": "Will Smith",
"firstName": "Will",
"lastName": "Smith",
"team": "Los Angeles Dodgers",
"teamId": 119,
"jerseyNumber": "16",
"position": "Catcher",
"positionAbbrev": "C",
"positionType": "Catcher",
"status": "Active",
"batSide": "Right",
"pitchHand": "Right",
"birthDate": "1995-03-28",
"age": 31,
"height": "5' 10\"",
"weight": 195,
"birthCity": "Louisville",
"birthStateProvince": "KY",
"birthCountry": "USA",
"mlbDebutDate": "2019-05-28",
"draftYear": 2016,
"active": true,
"season": 2026,
"hittingStats": {
"gamesPlayed": 128,
"avg": ".272",
"homeRuns": 20,
"rbi": 75,
"hits": 125,
"runs": 68,
"doubles": 24,
"triples": 2,
"atBats": 460,
"obp": ".358",
"slg": ".463",
"ops": ".821",
"stolenBases": 3,
"strikeOuts": 88,
"walks": 58
},
"pitchingStats": null,
"scrapedAt": "2026-11-10T14:40:00.000Z"
}

🏆 Standings record output

{
"recordType": "standing",
"season": 2026,
"league": "American League",
"division": "American League East",
"divisionId": 201,
"teamId": 147,
"team": "New York Yankees",
"wins": 94,
"losses": 68,
"winningPercentage": ".580",
"gamesPlayed": 162,
"gamesBack": "-",
"wildCardGamesBack": "-",
"divisionRank": 1,
"leagueRank": 1,
"sportRank": 2,
"streak": "W3",
"runsScored": 815,
"runsAllowed": 668,
"runDifferential": 147,
"homeRecord": "50-31",
"awayRecord": "44-37",
"lastTenRecord": "7-3",
"divisionChamp": true,
"clinched": true,
"clinchIndicator": "y",
"magicNumber": "-",
"eliminationNumber": "-"
}

📊 Field definitions & coverage

🧢 Player fields

FieldTypeDescriptionCoverage
playerIdNumberOfficial MLB persistent player identifier🟢 High (100%)
fullNameStringComplete legal player name🟢 High (100%)
teamStringCurrent operating franchise affiliation🟢 High (100%)
teamIdNumberOfficial franchise identifier🟢 High (100%)
positionStringPrimary defensive position designation🟢 High (100%)
positionAbbrevStringStandard positional acronym (SS, 1B, SP)🟢 High (100%)
batSide / pitchHandStringHandedness orientation🟢 High (100%)
age / height / weightMixedBiometric and physical attributes🟢 High (98%)
mlbDebutDateStringISO date of Major League debut appearance🟢 High (92%)
hittingStatsObjectSeason offensive splits (AVG, HR, RBI, OPS, OBP)🟡 Conditional (50%)
pitchingStatsObjectSeason pitching splits (ERA, W-L, SO, IP, WHIP)🟡 Conditional (50%)

🏆 Standings fields

FieldTypeDescriptionCoverage
teamStringTeam name🟢 High (100%)
league / divisionStringLeague and division names🟢 High (100%)
wins / lossesNumberOfficial win-loss record totals🟢 High (100%)
winningPercentageStringStandard three-decimal winning percentage🟢 High (100%)
gamesBackStringGames behind divisional leader (- for leader)🟢 High (100%)
divisionRankNumberDivisional position (1–5)🟢 High (100%)
streakStringActive momentum code (W4, L2)🟢 High (100%)
runsScored / runsAllowedNumberTotal season run production and concessions🟢 High (100%)
runDifferentialNumberNet score differential🟢 High (100%)
homeRecord / awayRecordStringSplit record strings (W-L)🟢 High (100%)

📊 Game & score fields

FieldTypeDescriptionCoverage
gamePkNumberOfficial unique MLB game key (deduplication key)🟢 High (100%)
officialDateStringScheduled calendar game date (YYYY-MM-DD)🟢 High (100%)
statusStringGame state (Final, In Progress, Scheduled)🟢 High (100%)
homeTeam / awayTeamStringHome and away franchise names🟢 High (100%)
homeScore / awayScoreNumberFinal run tallies🟢 High (100%)
winnerStringDecided match winner name🟢 High (98%)
venueStringHost stadium name🟢 High (100%)
seriesDescriptionStringCompetition bracket classification🟢 High (100%)

💡 Practical workflow strategies & tips

  • Segment by Data Category: When constructing automated sports data pipelines, trigger separate Apify runs for standings, scores, and players. Standings update upon game completions, scores are best scraped daily, and rosters can be refreshed weekly.
  • Explicit Season Targeting: Standings, teams, and player stats are tied to annual campaigns; specify season explicitly when conducting historical research across past eras.
  • Date Range Optimization: For scores, a single date string retrieves matches for that specific calendar day, while startDate and endDate parameters enable bulk aggregation of entire playoff series or road-trip stands.
  • Roster Depth Control: Use rosterType: "active" for the standard 26-man active MLB roster, or switch to 40Man to capture expanded rosters, September call-ups, and top prospects.
  • Target Specific Franchises: When monitoring specific teams, populate the teamIds input to bypass unaffected clubs and accelerate processing times.

Quick MLB franchise ID directory

  • 147 NY Yankees · 111 Boston Red Sox · 141 Toronto Blue Jays · 110 Baltimore Orioles · 139 Tampa Bay Rays
  • 119 LA Dodgers · 137 SF Giants · 135 SD Padres · 109 Arizona D-backs · 115 Colorado Rockies
  • 112 Chicago Cubs · 158 Milwaukee Brewers · 113 Cincinnati Reds · 134 Pittsburgh Pirates · 138 St. Louis Cardinals
  • 143 Philadelphia Phillies · 121 NY Mets · 144 Atlanta Braves · 146 Miami Marlins · 120 Washington Nationals
  • 114 Cleveland Guardians · 116 Detroit Tigers · 142 Minnesota Twins · 118 Kansas City Royals · 145 Chicago White Sox
  • 117 Houston Astros · 136 Seattle Mariners · 140 Texas Rangers · 133 Athletics · 108 LA Angels

💻 API & Integration examples

cURL

curl -X POST "https://api.apify.com/v2/acts/haketa~mlb-stats-scraper/runs?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dataType": "standings",
"season": 2026,
"maxItems": 30
}'

Python

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run_input = {
"dataType": "players",
"season": 2026,
"rosterType": "active",
"includePlayerStats": True,
"maxItems": 200
}
run = client.actor("haketa/mlb-stats-scraper").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
stats = item.get("hittingStats") or {}
print(f"{item.get('fullName')} ({item.get('team')}): AVG {stats.get('avg', 'N/A')} | HR {stats.get('homeRuns', 0)}")

Node.js / JavaScript

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: 'YOUR_APIFY_TOKEN',
});
const runInput = {
dataType: 'scores',
date: '2026-08-20',
maxItems: 50,
};
const run = await client.actor('haketa/mlb-stats-scraper').call(runInput);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Retrieved ${items.length} completed MLB games.`);

❓ Frequently Asked Questions

Why do position players show null pitching stats and vice versa? MLB player rosters divide duties between position players and pitchers. Position players generate batting records (hittingStats), while pitchers generate mound figures (pitchingStats). Two-way players record values in both blocks.

How are suspended or postponed games handled? The scraper assigns records strictly using the natural gamePk identifier. Resumed games or doubleheaders are recorded once, eliminating duplicate items from your score dataset.

Can I scrape historical seasons? Yes. You can supply historical seasons (e.g., 2021, 1998, 1985) to extract historical standings, teams, and seasonal player stat lines.

How fast does the player roster extraction complete? The actor uses parallel HTTP fan-out across all 30 teams with configurable concurrency. Pulling the complete active rosters of all 30 clubs with season stats takes approximately 8–12 seconds.



📋 Changelog

v1.2 (2026-11)

  • Zero-Cap Scalability: Optimized record extraction limits supporting continuous extraction of complete 30-team rosters without truncation.
  • Fast Prefill Execution: Aligned default prefill parameters to execute verified test sweeps in under 15 seconds.
  • Strict Schema Compliance: Sanitized dataset schemas, eliminating legacy fields blocks for flawless Apify specifications.
  • Deduplication Hardening: Enhanced multi-date schedule normalization preventing duplicate games across suspended matches.

v1.1 (2026-10)

  • Added Statcast group mappings for batting and pitching splits.
  • Enhanced division tiebreaker indicators in standings records.

v1.0 (2026-09)

  • Initial production release covering standings, teams, scores, and player rosters.