starYTTranslate is an open-source Python project designed to simplify the process of translating YouTube video subtitles. It utilizes the Gemini AI model to accurately translate text and saves it in .srt format for use with video players or editing software.
- 🎯 Subtitle Extraction: Automatically fetch subtitles from YouTube videos.
- 🌐 Translation via Gemini AI: Get high-quality, professional translations.
- 💾 Save as SRT: Compatible with most playback and editing software.
- 🖥️ Command-Line Interface (CLI): Simple and efficient to use.
starYTTranslate/
├── main.py # Application entry point
├── menu.py # Manages the main user menu
├── handlers/ # Service handler modules
│ ├── add_api_key.py # Add Gemini API key
│ └── sub_translate.py # Full translation logic
├── services/
│ ├── gemini_translate.py # Interacts with Gemini API
│ └── sub_extract.py # Extracts subtitles from YouTube
├── utils/
│ ├── ai_modle.py # API key validation
│ ├── messages.py # Error and info
│ ├── srt_tools.py # Tools for splitting and enhancing SRT files
│ └── welcome.py # Welcome message for the user
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Python 3.8 or higher
- Google Gemini API key (available from Google AI Studio)
git clone https://github.com/najm-flutter/starYTTranslate
cd starYTTranslatepython -m venv venv
.\venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython main.pyYou will be provided with a simple menu where you can:
- Add your Gemini API key
- Enter a YouTube video link for translation
- Run the application.
- Add your Gemini API key when prompted or choose option 2 from the menu.
- Choose option 1 to translate a video.
- Enter the YouTube video URL — subtitles will be extracted, translated, and saved as an
.srtfile.
We welcome contributions!
- Fork the repository.
- Create a new branch.
- Make your changes and commit them.
- Push your branch.
- Open a Pull Request.
This project is licensed under the MIT License.
If you have any feedback, please reach out to us at nagm113nagm@gmail.com
