Fetch football data from FlashScore.com.
Project description
FlashScore Football Library
Unofficial Python wrapper for flashscore.com
Overview • Installation • Available Classes • Usage
This is a fork of progeroffline/fs-football
Languages
Overview
This Python library allows you to easily fetch data about football matches from the FlashScore website (flashscore.com). It is designed for asynchronous operation, providing fast and efficient data retrieval. In some parts of the library, the grequests library is used to enhance performance.
Features
-
Asynchronous Data Retrieval: The library employs Python's asynchronous approach using the
asyncioframework to make asynchronous HTTP requests, allowing for efficient data retrieval from FlashScore. -
Historical Match Data: Access to historical data about past football matches, including match results, team statistics, and top scorers.
Installation
git clone https://github.com/progeroffline/fs-football
cd fs-football/
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
Usage
Here is a simple example of using the library to fetch historical match data:
from flashscore import FlashscoreApi
api = FlashscoreApi()
countries = api.get_countries()
for country in countries:
leagues = country.get_leagues()
for league in leagues:
season = league.get_season()
current_season = season[0]
for match in current_season.get_matches():
print(match)
match.load_content()
print(match)
Here is a simple example of using the library to fetch data about today's matches:
from flashscore import FlashscoreApi
api = FlashscoreApi()
today_matches = api.get_today_matches()
for i, match in enumerate(today_matches):
match.load_content()
Available Classes
StatValue
Represents a statistical value in a match.
name: The name of the statistical value.home: The value for the home team.away: The value for the away team.
Event
Represents an event in a match, such as a goal or a card.
type: The event type.player_name: The name of the player involved in the event.player_url: The URL associated with the player.time: The time when the event occurred (optional).current_score: The current score of the match (optional).second_player_name: The name of the second player involved in the event (optional).second_player_url: The URL associated with the second player (optional).description: Additional description of the event (optional).
HistoryMatch
Represents a historical match.
id: The unique identifier of the match.timestamp: The timestamp of the match.date: The date and time of the match.home_team_name: The name of the home team.home_team_score: The score of the home team.away_team_name: The name of the away team.away_team_score: The score of the away team.league_name: The name of the league to which the match belongs.country: The country in which the match took place.final_total_score: The final total score of the match.main_team: The main team in the match (optional).result_for_main_team: The result for the main team (optional).
Match
Represents a match, including its details and statistics.
id: The unique identifier of the match.country_name: The name of the country where the match took place (optional).league_name: The name of the league to which the match belongs (optional).timestamp: The timestamp of the match (optional).date: The date and time of the match (optional).tournament: The name of the tournament (optional).home_team_name: The name of the home team (optional).away_team_name: The name of the away team (optional).home_team_score: The score of the home team (optional).away_team_score: The score of the away team (optional).final_total_score: The final total score of the match (optional).status: The match status (optional).stats_match: A list of statistical values for the entire match.stats_first_half: A list of statistical values for the first half.stats_second_half: A list of statistical values for the second half.prematch_home_odds: Odds for the home team before the match (optional).prematch_middle_odds: Average odds before the match (optional).prematch_away_odds: Odds for the away team before the match (optional).events: A list of events that occurred during the match.home_matches: A list of historical matches for the home team.away_matches: A list of historical matches for the away team.head2head_matches: A list of historical matches between these two teams.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fs_football_fork-0.1.0.tar.gz.
File metadata
- Download URL: fs_football_fork-0.1.0.tar.gz
- Upload date:
- Size: 112.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95c5ce9280bdc1e7bce02a1ea0afe52c7b888039b84a9ef1efb21b16a0b5a86d
|
|
| MD5 |
27de6cf1ce5a7c1fc09036b94589462f
|
|
| BLAKE2b-256 |
e35ec352808144dc5069ee4fb276d5f1028979edfc386bc9e4d2f1d24fe040a9
|
File details
Details for the file fs_football_fork-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fs_football_fork-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
011c7b3356ad6637e865147842930e3d1c1949edf95c27cc0b54569c1c9b1e44
|
|
| MD5 |
4f540e26be49f9aa452e39dcb81f0e9a
|
|
| BLAKE2b-256 |
a85cd3b40b18826f1ec5f8fb0cd36eca22b7e7eb2ed3f9ef8c08cb99e547c4e9
|