How weebzone/surf-tg works
Surf-TG indexes media from authorized Telegram channels and serves it through a web application for search, download, and video streaming; authenticated administrators can also manage playlist folders and files. Channel messages are indexed into MongoDB, while browsing and streaming resolve Telegram messages and retrieve byte ranges through Telegram clients. The README also documents multi-channel indexing, thumbnails, configurable themes, and optional multi-client download scaling. Several route and startup sections were not sampled, so only visible or documented relationships are shown.
Main entry points: stream_routes.py Web routes · database.py Database operations · index.py Channel indexing · start.py Bot commands
Components 22
Telegram indexing
- Bot commands
bot/telegram/plugins/start.py - Channel indexing
bot/helper/index.py - Telegram clients
bot/telegram/clients.py
Web application
- Web routes
bot/server/stream_routes.py - Page rendering
bot/server/render_template.py - Web templates
bot/server/template - Playlist management
bot/helper/chats.py - Media search
bot/helper/search.py
Media delivery
- Range streaming
bot/server/custom_dl.py - File properties
bot/server/file_properties.py - Thumbnail handling
bot/helper/thumbnail.py
Storage and helpers
- Database operations
bot/helper/database.py - Index cache
bot/helper/cache.py - Runtime configuration
bot/config.py - Token parsing
bot/helper/parser.py - Media detection
bot/helper/media.py - Size formatting
bot/helper/file_size.py - Media errors
bot/helper/exceptions.py
Other components
- Browser visitor
- Channel operator
- Telegram
- MongoDB
Connections 29
- Channel operator → Bot commands: sends channel files
README.md - Bot commands → Channel indexing: indexes messages
bot/telegram/plugins/start.py - Bot commands → Database operations: stores indexed files
bot/telegram/plugins/start.py - Channel indexing → Telegram: fetches messages
bot/helper/index.py - Channel indexing → Database operations: reads and stores
bot/helper/index.py - Channel indexing → Index cache: reads and saves
bot/helper/index.py - Channel indexing → Size formatting: formats sizes
bot/helper/index.py - Browser visitor → Web routes: requests pages or media
README.md - Web routes → Page rendering: renders pages
bot/server/stream_routes.py - Page rendering → Web templates: loads templates
bot/server/render_template.py - Web routes → Database operations: reads and updates
bot/server/stream_routes.py - Web routes → Playlist management: builds playlist views
bot/server/stream_routes.py - Web routes → Media search: searches channel files
bot/server/stream_routes.py - Web routes → Range streaming: dispatches media requests
bot/server/stream_routes.py - Web routes → Thumbnail handling: serves thumbnails
bot/server/stream_routes.py - Web routes → Channel indexing: uses indexed files
bot/server/stream_routes.py - Media search → Database operations: searches stored files
bot/helper/search.py - Playlist management → Database operations: manages playlist data
bot/helper/chats.py - Range streaming → File properties: resolves file metadata
bot/server/custom_dl.py - Range streaming → Telegram: retrieves file bytes
- File properties → Telegram: fetches message media
bot/server/file_properties.py - File properties → Media detection: detects media
bot/server/file_properties.py - Page rendering → File properties: validates file links
bot/server/render_template.py - Telegram clients → Token parsing: parses bot tokens
bot/telegram/clients.py - Telegram clients → Telegram: starts worker bots
bot/telegram/clients.py - Bot commands → Runtime configuration: checks channel settings
bot/telegram/plugins/start.py - Database operations → Runtime configuration: gets connection settings
bot/helper/database.py - Database operations → MongoDB: persists playlist and indexes
bot/helper/database.py - Range streaming → Media errors: raises media errors
bot/server/custom_dl.py