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.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6797fd8d9aa17b81aedc19fc1414b2402f08a834b377d0727ba0c618aee684c8 |
|
MD5 | acbc9c529bfb4ef7dca96ad0a7848edb |
|
BLAKE2b-256 | bdecb1a86bf5dc915c993967eb7bbcd58e362c2ee19b853337afcbbb8021d932 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | baee0b4e7337b96159e40c246e92d34e32f5eec8a8d0667b8da37c25f61cafc3 |
|
MD5 | 33c6762c2edd998db992b06f6c81dc2f |
|
BLAKE2b-256 | 9f76610fe9b4e7759a309e9fdd5a2fc6c3089248e10c8e25c45ec1b20f13be23 |