How damantha126/youtube-dl-bot works
This is a Telegram bot for fetching YouTube media and offering downloadable audio or video formats. The main workflow accepts a YouTube URL, fetches its metadata and available formats, presents choices, downloads the selected media, and sends it back to the chat. Separate command handlers provide start and help responses; configuration supplies Telegram credentials and the request interval. The graph follows the sampled handlers and helpers. Plugin registration is visible in the entry point, but internal Pyrogram dispatch and the external service interactions are not fully shown.
Main entry points: youtube.py YouTube URL handler · __main__.py Bot entry point · youtube_callback_data.py Download callback handler · start.py Start command
Components 16
Bot runtime
- Bot entry point
bot/__main__.py - Bot configuration
config.py - User timing state
bot/__init__.py
Telegram interaction
- Start command
plugins/start.py - Help command
plugins/help.py - YouTube URL handler
plugins/youtube.py - Format choice handler
plugins/youtube_callback_data.py - Download callback handler
plugins/youtube_callback_data.py - Media reply
plugins/youtube_callback_data.py
Media processing
- Format and metadata lookup
helper/ytdlfunc.py - Media downloader
helper/ytdlfunc.py - Media duration probe
helper/ffmfunc.py - Downloaded media and thumbnails
plugins/youtube_callback_data.py
Shared support
- File size formatter
utils/util.py
Other components
- Telegram user
- Telegram platform
Connections 26
- Bot entry point → Bot configuration: loads credentials
bot/__main__.py - Bot entry point → Start command: registers plugins
bot/__main__.py - Bot entry point → Help command: registers plugins
bot/__main__.py - Bot entry point → YouTube URL handler: registers plugins
bot/__main__.py - Bot entry point → Format choice handler: registers plugins
bot/__main__.py - Bot entry point → Download callback handler: registers plugins
bot/__main__.py - Telegram user → Telegram platform: sends requests
README.md - Telegram platform → Start command: dispatches command
- Telegram platform → Help command: dispatches command
- Telegram platform → YouTube URL handler: dispatches URL
- YouTube URL handler → User timing state: reads and updates
plugins/youtube.py - YouTube URL handler → Bot configuration: reads interval
plugins/youtube.py - YouTube URL handler → Format and metadata lookup: fetches formats
plugins/youtube.py - YouTube URL handler → Telegram platform: replies with choices
plugins/youtube.py - Format and metadata lookup → File size formatter: formats sizes
helper/ytdlfunc.py - Telegram platform → Format choice handler: dispatches selection
- Format choice handler → Telegram platform: updates choices
plugins/youtube_callback_data.py - Telegram platform → Download callback handler: dispatches download choice
- Download callback handler → Media downloader: downloads selected media
plugins/youtube_callback_data.py - Download callback handler → Media duration probe: gets video duration
plugins/youtube_callback_data.py - YouTube URL handler → Downloaded media and thumbnails: writes thumbnail
plugins/youtube.py - Download callback handler → Downloaded media and thumbnails: reads thumbnail and saves media
plugins/youtube_callback_data.py - Download callback handler → Media reply: schedules media reply
plugins/youtube_callback_data.py - Media reply → Telegram platform: sends media
plugins/youtube_callback_data.py - Start command → Telegram platform: sends welcome
plugins/start.py - Help command → Telegram platform: sends instructions
plugins/help.py