This project fetches the latest Formula 1 team radio recordings, converts the audio to text using Google's Speech Recognition API, and posts the transcribed message to Twitter.
- Fetches the latest team radio data from the OpenF1 API.
- Downloads the latest team radio recording.
- Converts the audio from MP3 to WAV format.
- Uses Google's Speech Recognition API to transcribe the audio.
- Posts the transcribed message to Twitter with driver and team information.
- Python 3.6+
- pydub
- SpeechRecognition
- requests
- tweepy
- dotenv
-
Clone the repository:
git clone https://github.com/yourusername/team-radio-to-twitter.git cd team-radio-to-twitter
-
Create and activate a virtual environment (optional but recommended):
python -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the root of the project and add your Twitter API credentials:CONSUMER_KEY=your_consumer_key CONSUMER_SECRET=your_consumer_secret ACCESS_TOKEN=your_access_token ACCESS_TOKEN_SECRET=your_access_token_secret
- Run the script:
python main.py
main.py
: Contains the main logic for fetching, processing, and posting the team radio data.helpers/twitter.py
: Contains the helper functionpost_tweet
for posting tweets using Tweepy.audio_files/
: Directory where audio files are temporarily stored.