Football Scraper is a project designed to scrape the website flashscore.com to gather results and fixtures for a given football team. This tool is useful for football enthusiasts, analysts, and developers who want to automate the collection of match data.
- Scrapes results and fixtures for specified teams from flashscore.com.
- Configurable to run at startup or on a scheduled basis using cron.
- Serves the scraped data through an Express server.
The configuration for the scraper is done through a JSON file. Below is an example of the config file:
{
"teams": [
{
"name": "",
"resultsUrl": "https://www.flashscore.com/team/***/***/results/",
"fixturesUrl": "https://www.flashscore.com/team/***/***/fixtures/"
}
],
"timeZone": "utc",
"runAtStartup": true,
"port": 9000,
"cron": "0 0 * * *"
}
- teams: An array of teams to be scraped.
- name: The name of the team. This will also be used as the file name.
- resultsUrl: The URL on flashscore.com for the team’s latest results.
- fixturesUrl: The URL on flashscore.com for the team’s upcoming fixtures.
- timeZone: The base timezone for the calendar.
- runAtStartup: Boolean indicating if the script should run when started or only using cron.
- port: The port on which the Express server will serve the files.
- cron: The crontab expression to schedule the scraping job.
- Clone the repository:
git clone https://github.com/murilopereirame/football-scraper.git
- Navigate to the project directory:
cd football-scraper
- Install the dependencies:
npm install
- Update the config.json file with your desired teams and settings.
- Start the scraper:
npm run run
The data will be served on the specified port (default is 9000).
To run the scraper on a schedule, ensure the cron
parameter is set in the config.json
file. The default setting runs the scraper daily at midnight.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the GPLv3 License. See the LICENSE file for details.