Flashscore is a popular website providing live scores, statistics, and news across various sports. However, it lacks an official API for developers to access its data. This is where FlashscoreScraping comes in.
This project caters to users seeking reliable sports results data. Sports enthusiasts can leverage the scraper's data to track their favorite teams, analyze past results, and predict future outcomes. Moreover, researchers, students, and educators can utilize the data for academic purposes.
-
Clone the project:
git clone https://github.com/gustavofariaa/FlashscoreScraping.git
-
Navigate to the project directory:
cd FlashscoreScraping
-
Install dependencies:
npm install
-
Start the scraping:
To utilize the scraping, you need to specify a country and a league. Additionally, you can indicate whether to run the scraping in headless mode and specify the output file path.
Parameter Required Default Value Description country
✅ - The country for which results are to be crawled. league
✅ - The league for which results are to be crawled. headless
false
When specified, the scraping runs without a user interface. path
./src/data
The path to save the output file. type
json
The format of the output file ( json
orcsv
).Examples:
npm run start country=brazil league=serie-a-2023 headless
This command runs the s for the
Brazilian
Serie A 2023
inheadless mode
and saves the results inJSON
format tostandard output
.npm run start country=england league=premier-league-2022-2023 path=./src/data type=csv
This command runs the scraping for the
English
Premier League 2022-2023
ingraphical mode
and saves the results inCSV
format to the specified path./src/data
.
The data returned by the scraping includes information such as match date, team names, scores, and statistics.
Parameter | Type | Description |
---|---|---|
date |
string |
The date and time of the match. |
home |
object:Team |
Information about the home team. |
away |
object:Team |
Information about the away team. |
result |
object:Result |
Result of the match. |
statistics |
array<Statistic> |
An array of match statistics. |
{
"2Ba0ep6H": {
"date": "17.07.2023 20:00",
"home": {
"name": "Goias",
"image": "https://static.example.com/image/goias.png"
},
"away": {
"name": "Atletico-MG",
"image": "https://static.example.com/image/atletico-mg.png"
},
"result": {
"home": "0",
"away": "0",
"penalty": null,
"status": "FINISHED"
},
"statistics": [
{
"categoryName": "Expected Goals (xG)",
"homeValue": "1.79",
"awayValue": "0.26"
},
...
]
},
...
}
matchId,date,home.name,home.image,away.name,away.image,result.home,result.away,result.penalty,result.status,Expected Goals (xG).home,Expected Goals (xG).away,...
GCMMfLmA,17.07.2023 20:00,Goias,https://static.example.com/image/goias.png,Atletico-MG,https://static.example.com/image/atletico-mg.png,0,0,FINISHED,1.79,0.26,...
Parameter | Type | Description |
---|---|---|
name |
string |
The name of the team. |
image |
string |
The URL of the team's logo. |
{
"home": {
"name": "Goias",
"image": "https://static.example.com/image/goias.png"
},
"away": {
"name": "Atletico-MG",
"image": "https://static.example.com/image/atletico-mg.png"
}
}
home.name,home.image,away.name,away.image
Goias,https://static.example.com/image/goias.png,Atletico-MG,https://static.example.com/image/atletico-mg.png
Parameter | Type | Description |
---|---|---|
home |
string |
The score of the home team. |
away |
string |
The score of the away team. |
penalty |
string? |
The number of penalties awarded in the match (if applicable). |
status |
string |
The status of the match. |
{
"home": "0",
"away": "0",
"penalty": null,
"status": "FINISHED"
}
result.home,result.away,result.penalty,result.status
0,0,,FINISHED
Parameter | Type | Description |
---|---|---|
categoryName |
string |
The name of the statistical category. |
homeValue |
string |
The value of the statistic for the home team. |
awayValue |
string |
The value of the statistic for the away team. |
[
{
"categoryName": "Expected Goals (xG)",
"homeValue": "1.79",
"awayValue": "0.26"
},
{
"categoryName": "Ball Possession",
"homeValue": "42%",
"awayValue": "58%"
},
...
]
Expected Goals (xG).home,Expected Goals (xG).away,Ball Possession.home,Ball Possession.away,...
1.79,0.26,42%,58%,...
If you encounter any issues or have suggestions for improvements, feel free to open an issue.