ali181818/YouTube-Note-Taker
A Telegram bot that processes YouTube video transcripts and provides AI-generated summaries.
YouTube Note Taker πΊπ
A multilingual Telegram bot that processes YouTube video transcripts and provides AI-generated summaries.
Features β¨
- π¬ Extract transcripts from YouTube videos
- π€ Process transcripts using AI models (OpenAI, Anthropic Claude, or Google Gemini)
- π Support for multiple languages (currently English and Persian)
- β±οΈ Real-time progress tracking with visual indicators
- π€ User management with activation control
- π Message history tracking
- π§© Clean, object-oriented architecture
Requirements π οΈ
- π Python 3.8+
- π€ Telegram Bot API token
- π API keys for at least one of the supported LLM platforms (OpenAI, Anthropic, or Google Gemini)
- π Your Telegram user ID for admin notifications
Installation π
-
Clone this repository:
git clone https://github.com/ali181818/YouTube-Note-Taker.git cd YouTube-Note-Taker -
Install required packages:
pip install -r requirements.txt
-
Create a
.envfile in the project root with the following variables:# Telegram Bot Settings TOKEN_BOT=your_telegram_bot_token # LLM Settings OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key GEMINI_API_KEY=your_gemini_api_key DEFAULT_LLM=GEMINI # Admin Settings ADMIN_CHAT_ID=your_telegram_user_idπ‘ Tip: To find your Telegram user ID, you can use @userinfobot or @get_id_bot on Telegram. Just start the bot and it will display your user ID.
Usage βΆοΈ
-
Start the bot:
python main.py
-
Open Telegram and search for your bot by username
-
Start a conversation with the bot and send YouTube video links
Bot Commands π¬
/start- Initialize the bot/help- Display help information/status- Check your account status/language- Change the bot language
Admin Configuration π‘οΈ
By default, new users will have their access set to inactive. To activate a user:
- Find the user's chat ID in the database or the admin notification
- Use an SQL client to update the user's status:
UPDATE users SET is_active = 1 WHERE chat_id = user_chat_id;
Alternatively, you can modify the default in app/database/models.py to set is_active = True by default.
Project Structure ποΈ
project/
βββ .env # Environment variables
βββ README.md # This file
βββ main.py # Entry point
βββ requirements.txt # Python dependencies
βββ lang/ # Language files
β βββ en.json # English translations
β βββ fa.json # Persian translations
βββ app/ # Application code
β βββ config.py # Configuration and settings
β βββ database/ # Database related code
β β βββ models.py # SQLite database models
β β βββ repository.py # Data access layer
β βββ services/ # Core services
β β βββ youtube_service.py # YouTube API integration
β β βββ llm_service.py # LLM integration
β βββ telegram/ # Telegram bot code
β βββ bot.py # Bot initialization
β βββ handlers.py # Message handlers
β βββ utils.py # Utility functions
How It Works βοΈ
- The user sends a YouTube video link to the bot
- The bot extracts the video ID using regex
- The bot fetches the video transcript using the YouTube Transcript API
- The transcript is processed and formatted for readability
- The formatted transcript is sent to an LLM (Gemini, OpenAI, or Anthropic)
- The LLM generates a concise summary of the video content
- The summary is sent back to the user
Throughout this process, the bot provides real-time progress updates with visual indicators.
Customization π οΈ
Adding New Languages π
To add a new language:
- Create a new JSON file in the
langdirectory (e.g.,de.jsonfor German) - Copy the structure from an existing language file and translate all values
- Update the language selection keyboard in
app/telegram/handlers.pyto include the new language
Customizing LLM Prompts βοΈ
You can modify the default prompt template in app/config.py to change how the AI processes transcripts.
Database Schema ποΈ
The bot uses SQLite with two main tables:
users- Stores user information and preferencesmessages- Records message history
Contributing π€
Contributions are welcome! Please feel free to submit a Pull Request.