Skip to main content

python-espncricinfo

PyPI Downloads CI Docs Python

A Python client for ESPNcricinfo match, series, season, team and player data.

Description

Match pages are loaded with Playwright (WebKit), because ESPN's CDN refuses plain HTTP clients; player, series, season and team records come from ESPN's core JSON API. A Match needs both a match_id and a series_id, which Match.get_recent_matches() and Series(...).matches provide.

Disclaimer: This library is not intended for commercial use and neither it nor its creator has any affiliation with ESPNCricInfo. The LICENSE for this library applies only to the code, not to the data.

Installation

uv add python-espncricinfo

Or with pip:

pip install python-espncricinfo

After installation, install the Playwright WebKit browser (required for fetching match data):

uv run playwright install webkit

Recent matches

Summary().matches lists the matches on ESPNcricinfo's results page. Pass a date to look back; ESPN returns about two weeks of matches ending on that day.

>>> from espncricinfo.match import Match
>>> refs = Match.get_recent_matches(date="2026-02-28")
>>> len(refs)
195
>>> refs[0]
MatchRef(series_id=1523975, match_id=1523981)
>>> series_id, match_id = refs[0]  # MatchRefs unpack like tuples

Summary(date=...) wraps the same call; its result is in .matches.

A single match

A match needs both its match ID and series ID: the two numbers in a match page URL, or a MatchRef. Loading a match starts a headless WebKit browser.

>>> m = Match(1478914, 1478874)  # same as MatchRef(1478874, 1478914).to_match()
>>> m.description
'IND Women v AUS Women'
>>> m.match_class
'WT20I'
>>> m.result
'IND Women won by 17 runs'
>>> m.batting_scorecard[0][0]["name"], m.batting_scorecard[0][0]["runs"]
('S Mandhana', 82)
>>> m.bowling_scorecard[0][0]["name"], m.bowling_scorecard[0][0]["wickets"]
('D Brown', 0)

batting_scorecard and bowling_scorecard hold one list per innings and one dict per player.

Players

The player ID is the number at the end of a player's profile URL.

>>> from espncricinfo.player import Player
>>> p = Player(277916)
>>> p.full_name
'Ajinkya Madhukar Rahane'
>>> p.get_data(file_name="rahane_tests.csv", match_format=1, data_type="batting")

get_data writes one row per match (85 Tests for Rahane); get_career_summary and get_career_averages write the summary tables from the same Statsguru page.

Series, seasons and teams

>>> from espncricinfo.series import Series
>>> ipl = Series(1449924)
>>> ipl.name
'Indian Premier League'
>>> season = ipl.current_season
>>> season.year, len(season.teams)
(2025, 10)
>>> season.teams[0].name
'Chennai Super Kings'

series.season_objects lists every season and season.match_refs that season's matches. series.matches collects MatchRefs across all seasons (1,254 for the IPL), and series.current_matches keeps those in progress. team.players loads the squad on demand. ESPN's records for some bilateral tours are incomplete, for example listing one team for a two-team series.

Development

Unit tests (no network required — uses recorded fixtures):

uv run pytest

Integration tests (hits live ESPN Cricinfo via Playwright):

uv run pytest --live

Refreshing fixtures (re-records fixtures from live site):

uv run python scripts/refresh_fixtures.py

Integration tests and the fixture refresh need the WebKit browser:

uv run playwright install webkit

Metadata

Release files for python-espncricinfo 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-espncricinfo 1.0.1
File Size Uploaded Provenance
python_espncricinfo-1.0.1.tar.gz 18.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for python-espncricinfo 1.0.1
File Interpreter ABI Platform
python_espncricinfo-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / python_espncricinfo-1.0.1.tar.gz

Download URL python_espncricinfo-1.0.1.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3331e943bc735ee60076d702ec8b136b5a07e3d626994226786e28a6e07614c
BLAKE2b-256 checksum
How to use checksums
dde88c65eb11e7b1dd4889fc334d590f512e2724319b31f6e46c335acd280893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / python_espncricinfo-1.0.1-py3-none-any.whl

Download URL python_espncricinfo-1.0.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0544e4ef388113fb08efdcee748e5d06d2f90fc40de44065d6d3b7c01f12452
BLAKE2b-256 checksum
How to use checksums
e7dc9f43de4fc97d7d5f6997ef39dd67d57adc29e284571444287ad54e3a9524
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for python-espncricinfo 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_espncricinfo-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page