This project is a football match data scraper and chatbot application. It fetches football match data from a website or an API, processes it, and allows users to interact with the data through a chatbot interface.
- Scraping Match Data: Scrapes football match data from a website.
- Data Storage: Saves match data in a JSON file for later use.
- Chatbot Interface: Allows users to query match data through a chatbot that responds in Czech.
- Automatic Updates: Automatically updates match data once per day to ensure the latest information is available.
- Detailed Match Information: Includes competition name, teams, scores.
Install the required libraries using:
pip install -r requirements.txt-
Clone the Repository:
git clone <repository-url> cd <repository-folder>
-
Set Up API Keys:
- Replace the placeholder API key in
.envwith your OpenAI API key.
- Replace the placeholder API key in
-
Run the Application:
- Navigate to the
srcfolder:cd src - Run the main application:
python main.py
- Navigate to the
-
Chat with the Chatbot:
- The chatbot will greet you and allow you to ask questions about football matches.
- Type your queries in Czech, and the chatbot will respond with relevant match data.
- To exit the chatbot, type
exit.
- The application scrapes match data from a website.
- Match data includes:
- Date
- Competition
- Home and Away Teams
- Scores
- The application checks if the match data is up-to-date by comparing the current date with the last run date stored in
data/last_run_date.txt. - If the data is outdated, the scraper runs and updates the data in
data/scraped_matches.json.
- The chatbot uses OpenAI's GPT model to answer user queries about the match data.
- It uses the latest match data stored in
data/scraped_matches.json.
src/
├── main.py # Main application entry point
├── scraper.py # Web scraping logic
data/
├── scraped_matches.json # JSON file storing scraped match data
└── last_run_date.txt # File storing the last run date of the scraper
README.md # Project documentation
requirements.txt # Python dependencies
Run the chatbot by executing main.py:
python main.pyExample interaction:
Ahoj, jsem fotbalový analitik! Napište 'exit' pro ukončení.
Uživatel: Jaký byl výsledek zápasu mezi týmy X a Y?
ChatGPT: Zápas mezi týmy X a Y skončil 2:1.
Uživatel: exit
Sbohem!
- Ensure you have a valid OpenAI API key.
- The application is designed to work with Czech-language queries.
- Match data is updated automatically once per day.
This project is licensed under the MIT License. See the LICENSE file for details.