Code Monkey home page Code Monkey logo

python-espncricinfo's Introduction

python-espncricinfo

A Python 3 client for ESPNCricinfo's match, summary and player information.

Description

The splendid espncricinfo.com site not only provides individual HTML pages of cricket matches, it also provides a JSON representation of data from each match. This Python library provides access to many of those JSON attributes as well as some helper functions. All you need is the match ID, which is the number at the end of a match page URL. See the Usage section for instructions, and see match.py for individual functions.

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.

The current version of this library is 0.6.1. It is very much a work in progress, and bug reports and feature requests are welcomed.

Installation

pip3 install python-espncricinfo

Usage

For a summary of live matches, create an instance of the Summary class:

>>> from espncricinfo.summary import Summary
>>> s = Summary()
>>> s.match_ids
['68079', '68209', '68081', '61375', '65429']

For individual matches, pass in the ID as a string:

>>> from espncricinfo.match import Match
>>> m = Match('64148')
>>> m.description
'England [Marylebone Cricket Club] tour of Australia, Only ODI: Australia v England at Melbourne, Jan 5, 1971'

More recent matches will have more methods available to them (for older matches, those methods will return None). A full list of methods available to an instance of the Match class is in the code.

For player details, pass in the player ID (found in a player's URL - for example, Ajinkya Rahane is '277916'):

>>> from espncricinfo.player import Player
>>> p = Player('277916')
>>> p.name
'Ajinkya Rahane'

A full list of methods available to an instance of the Player class is in the code.

For series (or league) details, pass in the series ID (found in a match URL, for example, India's 2018 tour of England is '18018'):

>>> from espncricinfo.series import Series
>>> s = Series('18018')
>>> s.name
'India tour of Ireland and England 2018'

Tests

To run the tests:

python tests.py

Requirements

See requirements.txt

python-espncricinfo's People

Contributors

dwillis avatar ehsan1997 avatar sbshah97 avatar scrambldchannel avatar snyk-bot avatar soodoku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.