High-speed Telegram downloader using multiple helper bots
Project description
HyperDL: Superfast Telegram Downloader Library for Pyrogram Bots
HyperDL is a parallel, multi-bot download engine for Pyrogram bots, designed for ultra-fast Telegram file downloads.
Replace slow .download() with HyperDL and unleash full speed using helper bots!
Features
- Blazing fast: Download files in parallel using multiple helper bots.
- Plug-and-play: Drop into any Pyrogram bot—watermark bots, renamer bots, leech bots, and more.
- No core code changes needed: Use
HyperTGDownloaderas a drop-in replacement for Pyrogram’s download system. - Works for all media types: Documents, videos, audio, etc.
- Handles large files: Bypass Telegram’s rate limits by splitting downloads.
Requirements
- Python 3.8+
- pyrogram v2+
- tgcrypto
- At least one main bot and one or more helper bots (@BotFather bots)
- A dump chat (private/group/channel, all your helper bots and main bot must be admins)
Quickstart Example
-
Install dependencies:
pip install pyrogram tgcrypto
-
Setup your
config.py:class Config: API_ID = 123456 # from https://my.telegram.org API_HASH = "your_api_hash" BOT_TOKEN = "main_bot_token" HELPER_TOKENS = "helper1_token helper2_token" # space-separated tokens LEECH_DUMP_CHAT = -1001234567890 # your dump chat/channel ID DOWNLOAD_DIR = "downloads/" HYPER_THREADS = 8 CHUNK_SIZE = 1024 * 1024 # 1MB
-
Basic bot integration:
import asyncio from pyrogram import Client, filters, idle from config import Config from hypertgdownloader import HyperTGDownloader # Setup helper bots helper_bots = {} for i, token in enumerate(Config.HELPER_TOKENS.split()): helper_bots[i] = Client( f"helper_{i}", api_id=Config.API_ID, api_hash=Config.API_HASH, bot_token=token, in_memory=True ) helper_loads = {i: 0 for i in helper_bots} # Hyper downloader downloader = HyperTGDownloader( helper_bots=helper_bots, helper_loads=helper_loads, num_parts=Config.HYPER_THREADS, chunk_size=Config.CHUNK_SIZE, download_dir=Config.DOWNLOAD_DIR, ) main_bot = Client( "main_bot", api_id=Config.API_ID, api_hash=Config.API_HASH, bot_token=Config.BOT_TOKEN, in_memory=True ) @main_bot.on_message(filters.command("dl") & filters.reply) async def download_handler(client, message): replied = message.reply_to_message if not replied: await message.reply(" Reply to a media message with /dl.") return msg = await message.reply(" Downloading, please wait...") try: file_path = await downloader.download_media( replied, file_name=Config.DOWNLOAD_DIR, progress=None, progress_args=(), dump_chat=Config.LEECH_DUMP_CHAT ) if file_path: await msg.edit_text(f"Download complete:\n<code>{file_path}</code>") else: await msg.edit_text("Download failed or cancelled.") except Exception as e: await msg.edit_text(f" Error: {e}") async def main(): await asyncio.gather(*(bot.start() for bot in helper_bots.values())) await main_bot.start() await downloader.start() print("All bots started. Send /dl as a reply to a media message.") await idle() if __name__ == "__main__": loop = asyncio.get_event_loop() try: loop.run_until_complete(main()) finally: loop.run_until_complete(main_bot.stop()) for bot in helper_bots.values(): loop.run_until_complete(bot.stop()) loop.close()
Usage in Any Pyrogram Bot
Replace:
await message.download()
with:
await downloader.download_media(message, file_name="downloads/", dump_chat=LEECH_DUMP_CHAT)
- You can use all HyperDL features in watermark bots, video samplers, metadata editors, renamers, and more.
Tips
- All helper bots AND main bot must be admins in the dump chat!
- Your dump chat can be a private group, channel, or supergroup.
- Adjust
HYPER_THREADSandCHUNK_SIZEfor maximum speed according to server/network.
License
MIT.
Special Thanks ♥️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hypertgdownloader-0.1.0.tar.gz.
File metadata
- Download URL: hypertgdownloader-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a730e91e9f538dc66a01c4561e948417714cbc44a53358efb17bff277a3126fc
|
|
| MD5 |
543c8f86e4240ba26b0629be8e07f7a4
|
|
| BLAKE2b-256 |
11f73aa94cb425d2933ebb0c4fbcbf2bda40279589527627650166d73c6b8927
|
File details
Details for the file hypertgdownloader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hypertgdownloader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0292d5b24429d97a81bdcbad8a74fc11bf4a7cb76e23041dd542afaba781cd5
|
|
| MD5 |
35046c419c42e0877e4d3bda4364b40c
|
|
| BLAKE2b-256 |
51400c12ea5d0cba341f061f5c538dafd2b12ac1aa34791805b3b39c925e357f
|