Skip to main content

python-cricket-scraper is built to get cricket data from Cricsheet and ESPNCricInfo

Project description

python-cricket-scraper

python-cricket-scraper is built to get cricket data from Cricsheet and ESPNCricInfo

Installation

Use the package manager pip to install python-cricket-scraper.

pip3 install python-cricket-scraper

Usage

CricSheet files

1. using single file

from cricscraper.cricsheet import CricSheet

sheet = CricSheet(files=["647261.yaml"])
sheet.save()

2. using multiple files

from cricscraper.cricsheet import CricSheet

sheets = CricSheet(files=["647261.yaml", "792295.yaml", "1122727.yaml"])
sheets.save()

3. using files in a folder

from cricscraper.cricsheet import CricSheet

sheets = CricSheet(folder="folder/")
sheets.save()

save() method saves the CSV file, containing columns(mentioned ahead).

Notice that files parameter takes list, whereas folder takes name of folder as a string.


Using CricInfo class

CricInfo class takes match id to scrape the data.

Q. Where can I get match id?

A. Google any cricket match you want. Visit Espncricinfo and get match id from url(highlighted number). 647261 in this case

img

from cricscraper.cricinfo import CricInfo

match = CricInfo("647261")
match.match_name()
match.match_dates()
match.playing11()
match.summary()
match.scorecard()

There are many more methods in CricInfo class. I'll encourage you to check other methods using

help(CricInfo)

Using CricSheet & CricInfo class together

from cricscraper.cricsheet import CricSheet

sheet = CricSheet(files=["647261.yaml", "792295.yaml"])
data = sheet.get_more_info()

get_more_info() returns dictionary of CricInfo object, match id as key


Columns of CSV file

  1. match id - match id of the match as per ESPNCricInfo records.
  2. inning - Inning number.
  3. delivery - delivery number.
  4. over - Over number.
  5. batsman - batsman on strike.
  6. non striker - batsman on non-strike.
  7. bowler - Bowler.
  8. runs off bat - runs scored by batsman on particular delivery.
  9. extras - Extra runs of particular delivery.
  10. total - team total until particular delivery.
  11. extra kind - extra kind (byes, legbyes, widea or no ball)
  12. wicket kind - wicket kind (caught, bowled or lbw etc)
  13. player out - Player dismissed.
  14. fielders - Fielders involved in the wicket(caught, stumping etc).
  15. team1 - Playing team1.
  16. team2 - Playing team2.
  17. outcome - Match outcome type (normal - team1 or team2 won, draw - Match Drawn etc)
  18. winner - Match winner
  19. by - win by runs, wickets or innings (India won by 6 wickets, then by = wickets)
  20. win amount - Margin of victory (India won by 6 wickets, then win amount = 6)
  21. player of match - Player of match.
  22. toss winner - Toss winner.
  23. toss decision - Chosen bat or bowl.
  24. match type - Match format(ODI, ODM, TEST etc)
  25. venue - Venue.
  26. city - City of venue.
  27. gender - Male or female.
  28. umpire1 - Standing umpire 1
  29. umpire2 - Standing umpire 2

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-cricket-scraper-0.1.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

python_cricket_scraper-0.1.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file python-cricket-scraper-0.1.2.tar.gz.

File metadata

  • Download URL: python-cricket-scraper-0.1.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for python-cricket-scraper-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6797fd8d9aa17b81aedc19fc1414b2402f08a834b377d0727ba0c618aee684c8
MD5 acbc9c529bfb4ef7dca96ad0a7848edb
BLAKE2b-256 bdecb1a86bf5dc915c993967eb7bbcd58e362c2ee19b853337afcbbb8021d932

See more details on using hashes here.

File details

Details for the file python_cricket_scraper-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_cricket_scraper-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for python_cricket_scraper-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 baee0b4e7337b96159e40c246e92d34e32f5eec8a8d0667b8da37c25f61cafc3
MD5 33c6762c2edd998db992b06f6c81dc2f
BLAKE2b-256 9f76610fe9b4e7759a309e9fdd5a2fc6c3089248e10c8e25c45ec1b20f13be23

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page