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.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: python-cricket-scraper-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a58d8c3b34995f171c9e7e91a9151eaf241ee28232bac3c40482697bd47e52df
MD5 846025a774e76c5a05dc6d0c93445852
BLAKE2b-256 db1900ba121266a0b6aa47086806cb025293ab5539b53aaf2f18f82401d9457f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_cricket_scraper-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4b7620485a769d91f4f1a1eda7c6d8444a7d99d1ccec7634116b2fe34ecc60c
MD5 49638c8176d136ac56300d215ec32f99
BLAKE2b-256 fdbf693efea306ddd0b2f9978042a0f092662a1be3703b2f25618c95eaada366

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