MCPcopy
hub / github.com/anasty17/mirror-leech-telegram-bot

github.com/anasty17/mirror-leech-telegram-bot @main sqlite

repository ↗ · DeepWiki ↗
1,128 symbols 5,527 edges 131 files 135 documented · 12%
README

This Telegram Bot, based on python-aria-mirror-bot, has undergone substantial modifications and is designed for efficiently mirroring or leeching files from the Internet to various destinations, including Google Drive, Telegram, or any rclone-supported cloud. It is built using asynchronous programming in Python.

  • TELEGRAM CHANNEL: https://t.me/mltb_official_channel
  • TELEGRAM GROUP: https://t.me/mltb_official_support

Features

QBittorrent
  • External access to webui, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting
  • Select files from a Torrent before and during download using mltb file selector (Requires Base URL) (task option)
  • Seed torrents to a specific ratio and time (task option)
  • Edit Global Options while the bot is running from bot settings (global option)
Aria2c
  • Select files from a Torrent before and during download (Requires Base URL) (task option)
  • Seed torrents to a specific ratio and time (task option)
  • Netrc support (global option)
  • Direct link authentication for a specific link while using the bot (it will work even if only the username or password is provided) (task option)
  • Edit Global Options while the bot is running from bot settings (global option)
Sabnzbd
  • External access to web interface, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting
  • Remove files from job before and during download using mltb file selector (Requires Base URL) (task option)
  • Edit Global Options while the bot is running from bot settings (global option)
  • Servers menu to edit/add/remove usenet servers
TG Upload/Download
  • Split size (global, user, and task option)
  • Thumbnail (user and task option)
  • Leech filename prefix (user option)
  • Set upload as a document or as media (global, user and task option)
  • Upload all files to a specific chat (superGroup/channel/private/topic) (global, user, and task option)
  • Equal split size settings (global and user option)
  • Ability to leech split file parts in a media group (global and user option)
  • Download restricted messages (document or link) by tg private/public/super links (task option)
  • Choose transfer by bot or user session in case you have a premium plan (global, user option and task option)
  • Mix upload between user and bot session with respect to file size (global, user option and task option)
  • Upload with custom layout multiple thumbnail (global, user option and task option)
  • Topics support
Google Drive
  • Download/Upload/Clone/Delete/Count from/to Google Drive
  • Count Google Drive files/folders
  • Search in multiple Drive folder/TeamDrive
  • Use Token.pickle if the file is not found with a Service Account, for all Gdrive functions
  • Random Service Account for each task
  • Recursive Search (only with root or TeamDrive ID, folder ids will be listed with a non-recursive method). Based on Sreeraj searchX-bot. (task option)
  • Stop Duplicates (global and user option)
  • Custom upload destination (global, user, and task option)
  • Ability to choose token.pickle or service account and upload destinations from list with or without buttons (global, user and task option)
  • Index link support only for Bhadoo
Rclone
  • Transfer (download/upload/clone-server-side) without or with random service accounts (global and user option)
  • Ability to choose config, remote and path from list with or without buttons (global, user and task option)
  • Ability to set flags for each task or globally from config (global, user and task option)
  • Ability to select specific files or folders to download/copy using buttons (task option)
  • Rclone.conf (global and user option)
  • Rclone serve for combine remote to use it as index from all remotes (global option)
  • Upload destination (global, user and task option)
Status
  • Download/Upload/Extract/Archive/Seed/Clone Status
  • Status Pages for an unlimited number of tasks, view a specific number of tasks in a message (global option)
  • Interval message update (global option)
  • Next/Previous buttons to get different pages (global and user option)
  • Status buttons to get specific tasks for the chosen status regarding transfer type if the number of tasks is more than 30 (global and user option)
  • Steps buttons for how much next/previous buttons should step backward/forward (global and user option)
  • Status for each user (no auto refresh)
Yt-dlp
  • Yt-dlp quality buttons (task option)
  • Ability to use a specific yt-dlp option (global, user, and task option)
  • Netrc support (global option)
  • Cookies support (global option)
  • Embed the original thumbnail and add it for leech
  • All supported audio formats
Gallery-dl
  • Mirror and leech from gallery-dl supported sites
  • Supports custom gallery-dl options globally, per user, and per task
  • Supports cookies and config files for authenticated or advanced downloads
JDownloader
  • Synchronize Settings (global option)
  • Waiting to select (enable/disable files or change variants) before download start
  • DLC file support
  • All settings can be edited from the remote access to your JDownloader with Web Interface, Android App, iPhone App or Browser Extensions
Mongo Database
  • Store bot settings
  • Store user settings including thumbnails and all private files
  • Store RSS data
  • Store incomplete task messages
  • Store JDownloader settings
  • Store config.py file on first build and in case any change occurred to it, then next build it will define variables from config.py instead of database
Torrents Search
  • Search on torrents with Torrent Search API
  • Search on torrents with variable plugins using qBittorrent search engine
Archives
  • Extract splits with or without password
  • Zip file/folder with or without password and splits in case of leech
  • Using 7z package to extract with or without password all supported types
RSS
  • Based on this repository rss-chan
  • Rss feed (user option)
  • Title Filters (feed option)
  • Edit any feed while running: pause, resume, edit command and edit filters (feed option)
  • Sudo settings to control users feeds
  • All functions have been improved using buttons from one command.
Overall
  • Docker image support for linux amd64, arm64/v8, arm/v7
  • Edit variables and overwrite the private files while bot running (bot, user settings)
  • Update bot at startup and with restart command using UPSTREAM_REPO
  • Telegraph. Based on Sreeraj loaderX-bot
  • Mirror/Leech/Watch/Clone/Count/Del by reply
  • Mirror/Leech/Clone multi links/files with one command
  • Custom name for all links except torrents. For files you should add extension except yt-dlp links (global and user option)
  • Exclude files with specific extensions from being uploaded/cloned (global and user option)
  • View Link button. Extra button to open index link in browser instead of direct download for file
  • Queueing System for all tasks (global option)
  • Ability to zip/unzip multi links in same directory. Mostly helpful in unzipping tg file parts (task option)
  • Bulk download from telegram txt file or text message contains links separated by new line (task option)
  • Join split files that were split before by split(linux pkg) (task option)
  • Sample video Generator (task option)
  • Screenshots Generator (task option)
  • Ability to cancel upload/clone/archive/extract/split/queue (task option)
  • Cancel all buttons for choosing specific tasks status to cancel (global option)
  • Convert videos and audios to specific format with filter (task option)
  • Force start to upload or download or both from queue using cmds or args once you add the download (task option)
  • Shell and Executor
  • Add sudo users
  • Ability to save upload paths
  • Name Substitution to rename the files before upload
  • User can select whether he want to use his rclone.conf/token.pickle without adding mt: before path/gd-id
  • FFmpeg commands to execute it after download (task option)
  • Supported Direct links Generators:

mediafire (file/folders), hxfile.co (need cookies txt with name) [hxfile.txt], streamtape.com, streamsb.net, streamhub.ink, streamvid.net, doodstream.com, feurl.com, upload.ee, pixeldrain.com, racaty.net, 1fichier.com, 1drv.ms (Only works for file not folder or business account), filelions.com, streamwish.com, send.cm (file/folders), solidfiles.com, linkbox.to (file/folders), shrdsk.me ( sharedisk.io), akmfiles.com, wetransfer.com, pcloud.link, gofile.io (file/folders), easyupload.io, mdisk.me (with ytdl), tmpsend.com, qiwi.gg, berkasdrive.com, mp4upload.com, terabox.com (videos only file/folders).

How to deploy?

Prerequisites

1. Installing requirements
  • Clone this repo:
git clone https://github.com/anasty17/mirror-leech-telegram-bot mirrorbot/ && cd mirrorbot
  • For Debian based distros
sudo apt install python3 python3-pip

Install Docker by following the official Docker docs

  • For Arch and its derivatives:
sudo pacman -S docker python
  • Install dependencies for running setup scripts:
pip3 install -r requirements-cli.txt

2. Setting up config file
cp config_sample.py config.py

Fill up rest of the fields. Meaning of each field is discussed below.

1. Required Fields

  • BOT_TOKEN (Str): The Telegram Bot Token that you got from @BotFather.

  • OWNER_ID (Int): The Telegram User ID (not username) of the Owner of the bot.

  • TELEGRAM_API (Int): This is to authenticate your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org.

  • TELEGRAM_HASH (Str): This is to authenticate your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org.

2. Optional Fields - TG_PROXY (Dict): The Proxy settings as dict. Ex: {"scheme": "socks5", "hostname": "11.22.33.44", "port": 1234, "username": "user", "password": "pass"}. The username and password can be omitted if the proxy doesn’t require authorization.

  • USER_SESSION_STRING (Str): To download/upload from your telegram account if user is PREMIUM and to send rss. To generate session string use this command python3 generate_string_session.py after mounting repo folder for sure. NOTE: You can't use bot with private message. Use it with superGroup.

  • DATABASE_URL (Str): Your Mongo Database URL (Connection string). Follow this Create Database to create database. Data will be saved in Database: bot settings, users settings, rss data and incomplete tasks. NOTE: You can always edit all settings that saved in database from the official site -> (Browse collections).

  • DATABASE_NAME (Str): Name of the Mongo database. Default is mltb.

  • CMD_SUFFIX (Str|Int): Commands index number. This number will be added to the end of all commands.

  • AUTHORIZED_CHATS (Str): Fill user_id and chat_id of groups/users you want to authorize. To auth only specific topic(s) write it in this format chat_id|thread_id Ex:-100XXXXXXXXXXX or -100XXXXXXXXXXX|10 or -100XXXXXXXXXXX|10|12. Separate them by spaces.

  • SUDO_USERS (Str): Fill user_id of users whom you want to give sudo permission. Separate them by spaces.

  • UPLOAD_PATHS (Dict): Send Dict of keys that have path values. Example: {"path 1": "remote:rclonefolder", "path 2": "gdrive1 id", "path 3": "tg chat id", "path 4": "mt:remote:", "path 5": "b: @username"}.

  • DEFAULT_UPLOAD (Str): Whether rc to upload to RCLONE_PATH or gd to upload to GDRIVE_ID or bh to upload to BUZZHEAVIER_ACCOUNT_ID. Default is rc. Read More HERE.

  • STATUS_UPDATE_INTERVAL (Int): Time in seconds after which the progress/status message will be updated. Recommended 10 seconds at least.

  • STATUS_LIMIT (Int): Limit the no. of tasks shown in status message with buttons. Default is 4. NOTE: Recommended limit is 4 tasks.

  • EXCLUDED_EXTENSIONS (Str): File extensions that won't upload/clone. Separate them by spaces.

  • INCLUDED_EXTENSIONS (Str): File extensions to be uploaded/cloned. EXCLUDED_EXTENSIONS will be ignored if you filled this! Separate them by spaces.

  • INCOMPLETE_TASK_NOTIFIER (Bool): Get incomplete task messages after restart. Require database and superGroup. Default is False.

  • FILELION_API (Str): Filelion api key to mirror Filelion links. Get it from Filelion.

  • STREAMWISH_API (Str): Streamwish api key to mirror Streamwish links. Get it from Streamwish.

  • YT_DLP_OPTIONS (Dict): Dic

Core symbols most depended-on inside this repo

get
called by 563
bot/core/config_manager.py
data_button
called by 300
bot/helper/telegram_helper/button_build.py
split
called by 218
bot/helper/ext_utils/media_utils.py
send_message
called by 135
bot/helper/telegram_helper/message_utils.py
error
called by 114
bot/helper/mirror_leech_utils/download_utils/yt_dlp_download.py
set
called by 69
bot/core/config_manager.py
get_readable_file_size
called by 69
bot/helper/ext_utils/status_utils.py
edit_message
called by 65
bot/helper/telegram_helper/message_utils.py

Shape

Method 576
Function 431
Class 118
Route 3

Languages

Python100%

Modules by API surface

myjd/myjdapi.py82 symbols
bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py69 symbols
myjd/exception.py34 symbols
sabnzbdapi/job_functions.py27 symbols
bot/helper/mirror_leech_utils/download_utils/gallery_dl_download.py24 symbols
bot/helper/ext_utils/files_utils.py24 symbols
bot/helper/mirror_leech_utils/download_utils/torbox_resolver.py22 symbols
bot/helper/mirror_leech_utils/status_utils/qbit_status.py21 symbols
bot/helper/ext_utils/media_utils.py21 symbols
tests/test_alldebrid_magnet.py20 symbols
bot/modules/rss.py20 symbols
bot/helper/mirror_leech_utils/status_utils/aria2_status.py20 symbols

Dependencies from manifests, versioned

httpx0.27 · 1×
pytest7.4 · 1×
pytest-asyncio0.23 · 1×

For agents

$ claude mcp add mirror-leech-telegram-bot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact