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
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
- match id - match id of the match as per ESPNCricInfo records.
- inning - Inning number.
- delivery - delivery number.
- over - Over number.
- batsman - batsman on strike.
- non striker - batsman on non-strike.
- bowler - Bowler.
- runs off bat - runs scored by batsman on particular delivery.
- extras - Extra runs of particular delivery.
- total - team total until particular delivery.
- extra kind - extra kind (byes, legbyes, widea or no ball)
- wicket kind - wicket kind (caught, bowled or lbw etc)
- player out - Player dismissed.
- fielders - Fielders involved in the wicket(caught, stumping etc).
- team1 - Playing team1.
- team2 - Playing team2.
- outcome - Match outcome type (normal - team1 or team2 won, draw - Match Drawn etc)
- winner - Match winner
- by - win by runs, wickets or innings (India won by 6 wickets, then by = wickets)
- win amount - Margin of victory (India won by 6 wickets, then win amount = 6)
- player of match - Player of match.
- toss winner - Toss winner.
- toss decision - Chosen bat or bowl.
- match type - Match format(ODI, ODM, TEST etc)
- venue - Venue.
- city - City of venue.
- gender - Male or female.
- umpire1 - Standing umpire 1
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a58d8c3b34995f171c9e7e91a9151eaf241ee28232bac3c40482697bd47e52df |
|
MD5 | 846025a774e76c5a05dc6d0c93445852 |
|
BLAKE2b-256 | db1900ba121266a0b6aa47086806cb025293ab5539b53aaf2f18f82401d9457f |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b7620485a769d91f4f1a1eda7c6d8444a7d99d1ccec7634116b2fe34ecc60c |
|
MD5 | 49638c8176d136ac56300d215ec32f99 |
|
BLAKE2b-256 | fdbf693efea306ddd0b2f9978042a0f092662a1be3703b2f25618c95eaada366 |