MLB Player Stats Scraper avatar

MLB Player Stats Scraper

Pricing

from $1.32 / 1,000 result emitteds

Go to Apify Store
MLB Player Stats Scraper

MLB Player Stats Scraper

MLB player stats scraper on the official MLB stats API: season hitting, pitching and fielding stats per player (AVG, HR, RBI, OPS, ERA, WHIP, strikeouts) with team, league and position, ranked, as clean data.

Pricing

from $1.32 / 1,000 result emitteds

Rating

0.0

(0)

Developer

DevilScrapes

DevilScrapes

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

12 days ago

Last modified

Categories

Features

Limited permissions

Share

Devil Scrapes mark

MLB Player Stats Scraper

💰 $1.50 / 1 000 results  ·  pay per result, no start fee  ·  no credit card to try

The devil's in the data. 😈

MLB player stats scraper for the official MLB stats API. Pick the seasons and stat groups you want and get one clean row per player: hitting, pitching or fielding season stats, ranked, with team, league and position attached. Export to JSON, CSV or Excel, or pull it straight from the Apify API.

🎯 What this scrapes

The MLB stats API serves season leaderboards fifty players at a time, one stat group at a time. This Actor walks every page of every season and group you ask for and returns one row per player season line, with the stat block flattened into typed columns instead of nested JSON.

  • Hitting: games, plate appearances, at bats, runs, hits, doubles, triples, home runs, RBI, walks, strikeouts, stolen bases, AVG, OBP, SLG, OPS, BABIP, total bases and more.
  • Pitching: wins, losses, saves, holds, ERA, WHIP, innings pitched, strikeouts, walks, K/9, BB/9, HR/9, batters faced, pitch counts and more.
  • Fielding: games, assists, put outs, errors, chances, double plays, fielding percentage, range factor, innings.
  • Identity on every row: season, group, leaderboard rank, player id and name, team, league (AL / NL), position and the player pool applied.

🔥 Features

  • 🛡️ We look like a real visitor — every request carries a genuine browser identity, and we switch identities when the site pushes back, so you get data instead of block pages.
  • 🔁 We retry with exponential backoff on rate limits and server errors, honouring Retry-After. Up to 5 attempts per page.
  • 🌐 We rotate proxy sessions through Apify Proxy on every retry, with a fresh session and exit IP each time.
  • 🧊 Typed, deduplicated rows. Counts are integers, rates such as AVG and ERA are numbers, and the same player line never appears twice in your dataset.
  • 🧱 Fault isolation. One season or group that fails does not end the others; we log it and keep going.
  • 💰 Pay per output — no Actor start fee. You pay for the output events listed in Pricing.

💡 Use cases

  • Fantasy and DFS tools: refresh season hitting and pitching lines for projections and waiver-wire dashboards.
  • Sports betting and analytics teams: build player-level models from ranked MLB season stats across several years.
  • Journalists and bloggers: pull leaderboards for a season in one run instead of copying tables by hand.
  • Data science and teaching: a clean, typed baseball dataset for notebooks, courses and BI dashboards.

⚙️ How to use it

  1. Set seasons (for example 2025) and the groups you want: hitting, pitching, fielding.
  2. Leave playerPool on QUALIFIED for the qualified leaderboard, or switch to ALL to widen it.
  3. Set maxItems to bound the run, then start it and export the dataset.

📥 Input

FieldTypeRequiredDefaultNotes
seasonsarray<string>nocurrent yearFour-digit seasons, e.g. 2025.
groupsarray<string>nohittinghitting, pitching, fielding, paged in the order given.
playerPoolstringnoQUALIFIEDQUALIFIED leaderboard, or ALL players.
sportIdintegerno1MLB sport id (1 = Major League Baseball).
maxItemsintegerno100Hard cap on total rows across the run (1-50000).
proxyConfigurationobjectnoApify ProxyApify Proxy configuration.

Example input

{
"seasons": ["2025"],
"groups": ["pitching", "hitting"],
"playerPool": "QUALIFIED",
"sportId": 1,
"maxItems": 100,
"proxyConfiguration": { "useApifyProxy": true }
}

📤 Output

One row per player season line in a group. Fields that do not apply to a group are null. In the pitching group, shared fields such as hits, homeRuns and strikeOuts are the pitcher's totals allowed or recorded; use the group column to tell the groups apart.

FieldTypeNotes
seasonintegerSeason year.
groupstringhitting, pitching or fielding.
rankinteger | nullLeaderboard rank in the group and pool.
playerId / playerNameinteger / stringMLB person id and full name.
teamId / teamNameinteger | null / string | nullTeam.
leagueId / leagueinteger | null / string | nullLeague (AL / NL).
positionCode / positionAbbr / positionNamestring | nullPosition.
numTeamsinteger | nullTeams the player appeared for that season.
gamesPlayed, atBats, hits, homeRuns, rbi, ...integer | nullCount stats.
avg, obp, slg, ops, era, whip, ...number | nullRate stats as numbers.
inningsPitched, inningsstring | nullBaseball notation: 187.2 is 187 and 2/3 innings.
playerPool / sportIdstring / integerWhat the feed applied.
scrapedAtstringUTC ISO-8601 run timestamp.

The full column list is in the dataset schema (about 95 fields).

Example output record

{
"season": 2025,
"group": "hitting",
"rank": 1,
"playerId": 592450,
"playerName": "Aaron Judge",
"teamId": 147,
"teamName": "New York Yankees",
"leagueId": 103,
"league": "AL",
"positionAbbr": "RF",
"gamesPlayed": 152,
"atBats": 541,
"hits": 179,
"homeRuns": 53,
"rbi": 114,
"avg": 0.331,
"obp": 0.457,
"slg": 0.688,
"ops": 1.145,
"playerPool": "QUALIFIED",
"scrapedAt": "2026-10-12T08:00:00Z"
}

💰 Pricing

No Actor start fee. You pay for the output events below.

EventUSD per eventBilling unit
result-emitted$0.0015Charged for each player season line written to the dataset.

1,000 output events cost $1.50 at the standard rate, with no start charge.

Existing subscriber discounts remain available in the Apify Pricing tab.

🚧 Limitations

  • Season stats only. This returns season leaderboards by group. Game logs, schedules, rosters and play-by-play are out of scope.
  • Qualified by default. QUALIFIED returns the qualified leaderboard (for 2025: 145 hitters, 52 pitchers); switch playerPool to ALL for everyone with a stat line.
  • Traded players. A player who appeared for several teams can show up on more than one row; check numTeams and teamName.
  • Stat names follow the feed. Fields keep the MLB stats API's own names, and a field that does not apply to a group is null.
  • A season with no data is a success. It finishes with zero rows and a status message naming what was requested.

❓ FAQ

Do I need an MLB API key? No. This reads the official MLB stats API; there is nothing to sign up for.

How do I get both hitting and pitching? Put both in groups. Each group is paged separately and every row carries its group.

Why did my run return fewer rows than maxItems? Either the leaderboard has fewer players than your cap, or you asked for a single season and group. The status message tells you why each group stopped.

Can I pull several seasons at once? Yes. Pass several years to seasons; each season and group is paged in turn and every row carries its season.

What happens if a page is blocked or fails? We retry up to 5 times with a fresh proxy session each time. If a season and group still cannot be read, the others carry on and the status message says so. The run ends as failed only when a page was unreadable and nothing at all could be collected.

Can I run this on a schedule? Yes. Use Apify Schedules to refresh the leaderboard daily during the season.

💬 Your feedback

Found a bug, or need a field we don't return yet? Open an issue on the Actor's Issues tab. We read every one.