This is a Node.js script that uses Puppeteer to scrape player stats from the official IPL website (iplt20.com). It retrieves the top 10 players for the following categories:
- Orange Cap (most runs scored)
- Most fours
- Most sixes
- Most fifties
- Most centuries
The script saves the scraped data to a JSON file named "iplData.json" for each IPL season.
- Node.js installed on your system
- Puppeteer library installed via npm
- Clone the repository or copy the script file to your local machine.
- Open a terminal and navigate to the directory containing the script.
- Run
npm install puppeteer
to install the Puppeteer library.
-
Run the script using Node.js:
npm start
When scraping data, the script allows for retrieving information for specific IPL seasons by adjusting the value of the iplSeasonNumber
variable. Here's how the variable corresponds to the IPL seasons:
- Setting
iplSeasonNumber
to 1 retrieves data for the latest season season. - Setting
iplSeasonNumber
to 2 retrieves data for the season before the latest one. - Adjust the value accordingly to scrape data for different IPL seasons.