Skip to content

A powerful web-based Telegram video downloader that supports downloading videos from both public and private channels that you have access to.

Notifications You must be signed in to change notification settings

EricZhengH/teledown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TeleDown - Telegram Video Downloader

A powerful web-based Telegram video downloader that supports downloading videos from both public and private channels that you have access to.

โœจ Key Features

  • ๐Ÿ” Download from Private Channels - Access and download videos from private Telegram channels you're a member of
  • ๐Ÿ“บ Support for public channels and groups
  • ๐ŸŽฅ High-quality video downloads with original resolution
  • ๐Ÿ“Š Progress tracking with real-time updates via WebSocket
  • ๐ŸŒ Web-based interface - no installation required for users
  • ๐Ÿš€ Fast and efficient downloading with concurrent support
  • ๐Ÿ“ฑ Responsive design for desktop and mobile
  • ๐Ÿ”„ Session persistence - stay logged in across restarts
  • ๐Ÿ”ฝ Dual Download Options - Choose between single video download or intelligent batch download
  • ๐Ÿค– Smart Batch Detection - Automatically finds and groups related videos for batch downloading
  • ๐Ÿ” In-Channel Search - Search for specific content within channels
  • โซ Smart Navigation - Load newer or older messages with dedicated buttons
  • ๐ŸŽฏ Queue Management - Configurable concurrent download limits for optimal performance
  • ๐Ÿ” Auto-Retry - Automatic retry mechanism for failed downloads with exponential backoff

๐Ÿ› ๏ธ Tech Stack

  • Frontend: React + TypeScript + Vite
  • Backend: Node.js + Express + TypeScript
  • Telegram API: GramJS (MTProto client)
  • Database: SQLite for session management
  • Real-time Updates: Socket.IO
  • UI Components: Ant Design

๐Ÿ“‹ Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Telegram API credentials (API ID and API Hash)

๐Ÿš€ Installation

Step 1: Clone the Repository

git clone https://github.com/yourusername/teledown.git
cd teledown

Step 2: Install Dependencies

Install backend dependencies:

cd backend
npm install

Install frontend dependencies:

cd ../frontend
npm install

Step 3: Configure Telegram API

  1. Get your Telegram API credentials:

    • Visit https://my.telegram.org
    • Log in with your phone number
    • Go to "API Development Tools"
    • Create a new application if you haven't already
    • Copy your api_id and api_hash
  2. Create environment configuration:

Backend configuration (backend/.env):

API_ID=your_api_id
API_HASH=your_api_hash
SESSION_STRING=optional_session_string
PORT=8000
DATABASE_PATH=./database.db
DOWNLOAD_PATH=./downloads
MAX_CONCURRENT_DOWNLOADS=2  # Number of simultaneous downloads (default: 2)

Frontend configuration (frontend/.env):

VITE_API_URL=http://localhost:8000

Step 4: Build the Project

Build the backend:

cd backend
npm run build

Build the frontend:

cd ../frontend
npm run build

๐Ÿƒโ€โ™‚๏ธ Running the Application

Development Mode

Start the backend server:

cd backend
npm run dev

In a new terminal, start the frontend development server:

cd frontend
npm run dev

The application will be available at:

Production Mode

Start the backend server:

cd backend
npm start

For the frontend, serve the built files:

cd frontend
npm run preview
# Or use any static server like nginx, apache, etc.

๐ŸŒŸ Key Features Explained

Smart Download System

TeleDown features an intelligent dual-download system that adapts to your needs:

๐Ÿ”ฝ Single Video Download (Blue Button)

  • Downloads only the selected video file
  • Perfect for specific content you need immediately
  • Faster for individual files
  • No additional processing or analysis

๐Ÿ“ฆ Intelligent Batch Download (Purple Button)

  • Smart Content Detection: Automatically analyzes message patterns to find related videos
  • Text Message Association: Uses adjacent text messages to group related content
  • Automatic Folder Organization: Creates folders based on the descriptive text content
  • Confirmation Dialog: Shows you exactly what will be downloaded before starting
  • Queue Management: Downloads are processed in controlled batches (configurable via MAX_CONCURRENT_DOWNLOADS)
  • Clean File Naming: Preserves original filenames from Telegram for consistency

How Batch Download Works:

  1. Analyzes the selected video's context within the channel
  2. Searches backward and forward for related text messages
  3. Identifies video groups based on message timestamps and content patterns
  4. Presents a confirmation dialog with folder name and video list
  5. Downloads all related videos to an organized folder structure

This intelligent system is perfect for content series, multi-part videos, or collections that are posted together but may be separated by other messages in the channel.

๐Ÿ“– Usage Guide

1. Login to Telegram

  • Open the application in your browser
  • Enter your phone number with country code
  • Enter the verification code sent to your Telegram app
  • If you have 2FA enabled, enter your password
  • Your session will be saved for future use

2. Browse Channels

  • View all channels you have access to (both public and private)
  • Search channels by name
  • See channel statistics (member count, post count)
  • Channels are paginated for better performance

3. Download Videos

  • Click on any channel to view its media content
  • Preview video thumbnails and information with metadata (duration, file size)
  • Two Download Options Available:
    • ๐Ÿ”ฝ Single Download (Blue Button): Downloads only the selected video
    • ๐Ÿ“ฆ Batch Download (Purple Button): Automatically finds and downloads all related videos in the group
  • Monitor real-time download progress with WebSocket updates
  • Downloads are organized into folders based on content groups
  • All downloads are saved to the configured directory

4. Manage Downloads

  • View active downloads with progress bars
  • See queued downloads waiting to start
  • Cancel unwanted downloads
  • Access download history
  • Automatic retry for failed downloads (FILE_REFERENCE_EXPIRED errors)
  • Configurable concurrent download limits

๐Ÿ”’ Security & Privacy

  • Secure Authentication: Uses official Telegram MTProto protocol
  • Session Encryption: All session data is encrypted locally
  • No Third Parties: Direct connection to Telegram servers
  • Private Downloads: Your download activity is completely private
  • Data Protection: No user data is collected or shared

๐Ÿ“ Project Structure

teledown/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/     # Request handlers
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ models/          # Data models
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Utility functions
โ”‚   โ”‚   โ””โ”€โ”€ index.ts         # Entry point
โ”‚   โ”œโ”€โ”€ downloads/           # Downloaded files
โ”‚   โ”œโ”€โ”€ sessions/            # User sessions
โ”‚   โ””โ”€โ”€ database.db          # SQLite database
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/           # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # API services
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/           # Custom hooks
โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Utilities
โ”‚   โ”‚   โ””โ”€โ”€ App.tsx          # Main component
โ”‚   โ””โ”€โ”€ dist/                # Built files
โ””โ”€โ”€ README.md

๐Ÿ”ง API Documentation

Authentication

  • POST /api/auth/send-code - Send verification code
  • POST /api/auth/verify-code - Verify code and login
  • POST /api/auth/check-session - Check session status
  • POST /api/auth/logout - Logout and clear session

Channels

  • GET /api/channels - List all accessible channels
  • GET /api/channels/:id - Get channel details
  • GET /api/channels/:id/media - Get channel media

Downloads

  • POST /api/download/start - Start single video download
  • POST /api/download/batch - Start batch download of related videos
  • POST /api/download/find-related - Find videos related to a specific video
  • GET /api/download/progress/:id - Get download progress
  • POST /api/download/cancel/:id - Cancel download
  • GET /api/download/history - Get download history

๐Ÿšจ Troubleshooting

Common Issues

  1. Login Issues

    • Ensure phone number includes country code
    • Check if 2FA is enabled on your account
    • Clear browser cache and cookies
  2. Download Failures

    • Check internet connection
    • Verify you have access to the channel
    • Ensure sufficient disk space
    • FILE_REFERENCE_EXPIRED errors are automatically retried
  3. Session Expired

    • Re-login with your credentials
    • Sessions expire after 30 days of inactivity
  4. Slow Batch Downloads

    • Adjust MAX_CONCURRENT_DOWNLOADS in .env file
    • Default is 2 for stability, can be increased based on your connection

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write unit tests for new features
  • Update documentation as needed
  • Ensure code passes linting

โš ๏ธ Disclaimer

This tool is intended for personal use only. Please respect content creators' rights and Telegram's Terms of Service:

  • Only download content you have permission to access
  • Do not redistribute downloaded content without permission
  • Respect copyright and intellectual property rights
  • Use responsibly and ethically

The developers are not responsible for any misuse of this tool.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • GramJS - Telegram MTProto client library
  • Ant Design - React UI component library
  • Vite - Next generation frontend tooling
  • Socket.IO - Real-time bidirectional communication

๐Ÿ“ž Support

If you encounter any issues or have questions:

  • Check the Issues page
  • Create a new issue with detailed information
  • Include error messages and steps to reproduce
  • Join our Telegram Support Group

๐Ÿ”ฎ Future Features

  • Batch download with queue management
  • In-channel search functionality
  • Load newer/older messages navigation
  • Download scheduling
  • Video quality selection
  • Audio-only extraction
  • Subtitle download support
  • Docker support for easy deployment
  • Mobile app (React Native)
  • Download resume capability
  • Export download history

โญ Star this repository if you find it useful!

Note: This tool requires active Telegram account authentication and only works with channels you have legitimate access to. It's designed to help you manage and backup your accessible content for personal use.

About

A powerful web-based Telegram video downloader that supports downloading videos from both public and private channels that you have access to.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published