Official Repository: Telegram bot which can download direct links, torrents, nzb, google drive, telegram document, any file/folder from rclone supported clouds, all yt-dlp supported sites and jdownloader supported sites, then upload them to google drive, telegram cloud or to one of rclone supported clouds
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.
root
or TeamDrive ID, folder ids will be listed with a non-recursive method). Basedamd64, arm64/v8, arm/v7
UPSTREAM_REPO
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).
git clone https://github.com/anasty17/mirror-leech-telegram-bot mirrorbot/ && cd mirrorbot
sudo apt install python3 python3-pip
Install Docker by following the official Docker docs
sudo pacman -S docker python
pip3 install -r requirements-cli.txt
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 thisTELEGRAM_HASH
(Str
): This is to authenticate your Telegram account for downloading Telegram files. You can get this2. 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).CMD_SUFFIX
(Str
|Int
): Commands index number. This number will added at the end 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 space.SUDO_USERS
(Str
): Fill user_id of users whom you want to give sudo permission. Separate them by space.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”: “mrcc:remote:”, “path 5”: “b: @username”}.DEFAULT_UPLOAD
(Str
): Whether rc
to upload to RCLONE_PATH
or gd
to upload to GDRIVE_ID
. Default is rc
. ReadSTATUS_UPDATE_INTERVAL
(Int
): Time in seconds after which the progress/status message will be updated. Recommended 10
STATUS_LIMIT
(Int
): Limit the no. of tasks shown in status message with buttons. Default is 4
. NOTE: Recommended4
tasks.EXCLUDED_EXTENSIONS
(Str
): File extensions that won’t upload/clone. Separate them by space.INCOMPLETE_TASK_NOTIFIER
(Bool
): Get incomplete task messages after restart. Require database and superGroup. DefaultFalse
.FILELION_API
(Str
): Filelion api key to mirror Filelion links. Get itSTREAMWISH_API
(Str
): Streamwish api key to mirror Streamwish links. Get itYT_DLP_OPTIONS
(Dict
): Dict of yt-dlp options. Check all possibleUSE_SERVICE_ACCOUNTS
(Bool
): Whether to use Service Accounts or not, with google-api-python-client. For this to workFalse
.FFMPEG_CMDS
(Dict
): Dict of list values of ffmpeg commands. You can set multiple ffmpeg commands for all files before upload. Don’t write ffmpeg at beginning, start directly with the arguments. Dict
-del
to the list which you want from the bot to delete the original files after command run complete!-del
will delete the original media after complete run of the cmd.NAME_SUBSTITUTE
(Str
): Add word/letter/character/sentense/pattern to remove or replace with other words with sensitive case or without.\BACKSLASH
, those are the characters: \^$.|?*+()[]{}-
3. GDrive Tools
GDRIVE_ID
(Str
): This is the Folder/TeamDrive ID of the Google Drive OR root
to which you want to upload all the mirrors using google-api-python-client.IS_TEAM_DRIVE
(Bool
): Set True
if uploading to TeamDrive using google-api-python-client. Default is False
.INDEX_URL
(Str
): Refer to https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index.STOP_DUPLICATE
(Bool
): Bot will check file/folder name in Drive incase uploading to GDRIVE_ID
. If it’s present in Drive then downloading or cloning will be stopped. (NOTE: Item will be checked using name and not hash, so this feature is not perfect). Default is False
.4. Rclone
RCLONE_PATH
(Str
): Default rclone path to which you want to upload all the files/folders using rclone.RCLONE_FLAGS
(Str
): key:value|key|key|key:value . Check here all RcloneFlags.RCLONE_SERVE_URL
(Str
): Valid URL where the bot is deployed to use rclone serve. Format of URL should be http://myip
, where myip
is the IP/Domain(public) of your bot or if you have chosen port other than 80
so write it in this format http://myip:port
(http
and not https
). Str
RCLONE_SERVE_PORT
(Int
): Which is the RCLONE_SERVE_URL Port. Default is 8080
.RCLONE_SERVE_USER
(Str
): Username for rclone serve authentication.RCLONE_SERVE_PASS
(Str
): Password for rclone serve authentication.5. Update
UPSTREAM_REPO
(Str
): Your github repository link, if your repo is private add https://username:{githubtoken}@github.com/{username}/{reponame}
format. Get token from Github settings. So you can update your bot from filled repository on each restart.
UPSTREAM_BRANCH
(Str
): Upstream branch for update. Default is master
.6. Leech
LEECH_SPLIT_SIZE
(Int
): Size of split in bytes. Default is 2GB
. Default is 4GB
if your account is premium.AS_DOCUMENT
(Bool
): Default type of Telegram file upload. Default is False
mean as media.EQUAL_SPLITS
(Bool
): Split files larger than LEECH_SPLIT_SIZE into equal parts size (Not working with zip cmd). Default is False
.MEDIA_GROUP
(Bool
): View Uploaded splitted file parts in media group. Default is False
.USER_TRANSMISSION
(Bool
): Upload/Download by user session. Only in superChat. Default is False
.HYBRID_LEECH
(Bool
): Upload by user and bot session with respect to file size. Only in superChat. Default is False
.LEECH_FILENAME_PREFIX
(Str
): Add custom word to leeched file name.LEECH_DUMP_CHAT
(Int
|Str
): ID or USERNAME or PM(private message) to where files would be uploaded. Add -100
before channel/superGroup id. To use only specific topic write it in this format chat_id|thread_id
. Ex:-100XXXXXXXXXXX or -100XXXXXXXXXXX|10 or pm or @xxxxxxx or @xxxxxxx|10.THUMBNAIL_LAYOUT
(Str
): Thumbnail layout (widthxheight, 2x2, 3x3, 2x4, 4x4, …) of how many photo arranged for the thumbnail.7. qBittorrent/Aria2c/Sabnzbd
TORRENT_TIMEOUT
(Int
): Timeout of dead torrents downloading with qBittorrent and Aria2c in seconds.BASE_URL
(Str
): Valid BASE URL where the bot is deployed to use torrent/nzb web files selection. Format of URL should be http://myip
, where myip
is the IP/Domain(public) of your bot or if you have chosen port other than 80
so write it in this format http://myip:port
(http
and not https
).BASE_URL_PORT
(Int
): Which is the BASE_URL Port. Default is 80
.WEB_PINCODE
(Bool
): Whether to ask for pincode before selecting files from torrent in web or not. Default is False
.
MaxConnections
, decrease AsyncIOThreadsCount
, set limit of DiskWriteCacheSize
to 32
and decrease MemoryWorkingSetLimit
from qbittorrent.conf or bsetting command.8. JDownloader
JD_EMAIL
(Str
): jdownloader email sign up on JDownloader.JD_PASS
(Str
): jdownloader password.
9. Sabnzbd
USENET_SERVERS
(List
): list of dictionaries, you can add as much as you want and there is a button for servers in sabnzbd settings to edit current servers and add new servers.
[{‘name’: ‘main’, ‘host’: ‘’, ‘port’: 563, ‘timeout’: 60, ‘username’: ‘’, ‘password’: ‘’, ‘connections’: 8, ‘ssl’: 1, ‘ssl_verify’: 2, ‘ssl_ciphers’: ‘’, ‘enable’: 1, ‘required’: 0, ‘optional’: 0, ‘retention’: 0, ‘send_group’: 0, ‘priority’: 0}]
Open port 8070 in your vps to access full web interface from any device. Use it like http://ip:8070/sabnzbd/. username: mltb, password: mltbmltb
10. RSS
RSS_DELAY
(Int
): Time in seconds for rss refresh interval. Recommended 600
second at least. Default is 600
in sec.RSS_SIZE_LIMIT
(INT
): Item size limit in bytes. Default is 0
.RSS_CHAT
(Int
|Str
): Chat ID or USERNAME or ID|TOPIC_ID or USERNAME|TOPIC_ID
where rss links will be sent. If you want message to be sent to the channel then add channel id. Add -100
before channel id.
RSS_CHAT
is required, otherwise monitor will not work. You must use USER_STRING_SESSION
--OR-- CHANNEL. If using channel then bot should be added in both channel and group(linked to channel) and RSS_CHAT
is the channel id, so messages sent by the bot to channel will be forwarded to group. Otherwise with USER_STRING_SESSION
add group id for RSS_CHAT
. If DATABASE_URL
not added you will miss the feeds while bot offline.11. Queue System
QUEUE_ALL
(Int
): Number of parallel tasks of downloads and uploads. For example if 20 task added and QUEUE_ALL
is 8
, then the summation of uploading and downloading tasks are 8 and the rest in queue. NOTE: if you want to fill QUEUE_DOWNLOAD
or QUEUE_UPLOAD
, then QUEUE_ALL
value must be greater than or equal to the greatest one and less than or equal to summation of QUEUE_UPLOAD
and QUEUE_DOWNLOAD
.QUEUE_DOWNLOAD
(Int
): Number of all parallel downloading tasks.QUEUE_UPLOAD
(Int
): Number of all parallel uploading tasks.12. Torrent Search
SEARCH_API_LINK
(Str
): Search api app link. Get your api from deploying this repository.
1337x, Piratebay, Nyaasi, Torlock, Torrent Galaxy, Zooqle, Kickass, Bitsearch, MagnetDL, Libgen, YTS, Limetorrent,
TorrentFunk, Glodls, TorrentProject and YourBittorrent
SEARCH_LIMIT
(Int
): Search limit for search api, limit for each site and not overall result limit. Default is zero (Default api limit for each site).SEARCH_PLUGINS
(List
): List of qBittorrent search plugins (github raw links). I have added some plugins, you can remove/add plugins as you want. Main Source: qBittorrent Search Plugins (Official/Unofficial).Make sure you still mount the repo folder and installed the docker from official documentation.
sudo docker build . -t mltb
sudo docker run --network host mltb
sudo docker ps
sudo docker stop id
sudo apt install docker-compose-plugin
sudo docker compose up
sudo docker compose up --build
sudo docker compose stop
sudo docker compose start
sudo docker compose logs --follow
IMPORTANT NOTES:
sudo iptables -F
sudo iptables -t nat -F
Set BASE_URL_PORT
and RCLONE_SERVE_PORT
variables to any port you want to use. Default is 80
and 8080
respectively.
Check the number of processing units of your machine with nproc
cmd and times it by 4, then
edit AsyncIOThreadsCount
in qBittorrent.conf or while bot working from bsetting->qbittorrent settings.
mirror - or /m Mirror
qbmirror - or /qm Mirror torrent using qBittorrent
jdmirror - or /jm Mirror using jdownloader
nzbmirror - or /nm Mirror using sabnzbd
ytdl - or /y Mirror yt-dlp supported links
leech - or /l Upload to telegram
qbleech - or /ql Leech torrent using qBittorrent
jdleech - or /jl Leech using jdownloader
nzbleech - or /nl Leech using sabnzbd
ytdlleech - or /yl Leech yt-dlp supported links
clone - Copy file/folder to Drive
count - Count file/folder from GDrive
usetting - or /us User settings
bsetting - or /bs Bot settings
status - Get Mirror Status message
sel - Select files from torrent
rss - Rss menu
list - Search files in Drive
search - Search for torrents with API
cancel - or /c Cancel a task
cancelall - Cancel all tasks
forcestart - or /fs to start task from queue
del - Delete file/folder from GDrive
log - Get the Bot Log
auth - Authorize user or chat
unauth - Unauthorize uer or chat
shell - Run commands in Shell
aexec - Execute async function
exec - Execute sync function
restart - Restart the Bot
restartses - Restart Telegram Session(s)
stats - Bot Usage Stats
ping - Ping the Bot
help - All cmds with description
NOTES
Termux
.generate_drive_token.py
in local browser.pip3 install google-api-python-client google-auth-httplib2 google-auth-oauthlib
python3 generate_drive_token.py
rclone config
command.RCLONE_PATH
is like GDRIVE_ID
a default path for mirror. In additional to those variables DEFAULT_UPLOAD
toDEFAULT_UPLOAD
= ‘rc’ then you must fill RCLONE_PATH
with path as default one or with rcl
to selectDEFAULT_UPLOAD
= ‘gd’ then you must fill GDRIVE_ID
with folder/TD id.rclone/{user_id}.conf
then RCLONE_PATH
must start with mrcc:
.mrcc:
at the beginning.UPSTREAM_REPO
variable can be used for edit/add any file in repository.UPSTREAM_REPO
private one in case you want to grab all files including private files.UPSTREAM_REPO
and your private files in thisUPSTREAM_REPO
.UPSTREAM_REPO
with the official repository link, then be carefull incase any change inUPSTREAM_REPO
to you fork link with that old updates.UPSTREAM_REPO
with your fork link be carefull also if you fetched the commits from theUPSTREAM_REPO
will take affect only after restart.-d
argument alone will lead to use global options for aria2c or qbittorrent.GlobalMaxRatio
and GlobalMaxSeedingMinutes
in qbittorrent.conf, -1
means no limit, but you canMaxRatioAction
.--seed-ratio
(0 means no limit) and --seed-time
(0 means no seed) in aria.sh.For Service Account to work, you must set
USE_SERVICE_ACCOUNTS
= “True” in config file or environment variables.
NOTE: Using Service Accounts is only recommended while uploading to a Team Drive.
Warning: Abuse of this feature is not the aim of this project and we do NOT recommend that you make a lot of
projects, just one project and 100 SAs allow you plenty of use, its also possible that over abuse might get your
projects banned by Google.
NOTE: If you have created SAs in past from this script, you can also just re download the keys by running:
python3 gen_sa_accounts.py --download-keys $PROJECTID
NOTE: 1 Service Account can upload/copy around 750 GB a day, 1 project can make 100 Service Accounts so you can
upload 75 TB a day.
NOTE: All people can copy
2TB/DAY
from each file creator (uploader account), so if you got
erroruserRateLimitExceeded
that doesn’t mean your limit exceeded but file creator limit have been exceeded which
is2TB/DAY
.
Choose one of these methods
python3 gen_sa_accounts.py --list-projects
python3 gen_sa_accounts.py --enable-services $PROJECTID
python3 gen_sa_accounts.py --create-sas $PROJECTID
python3 gen_sa_accounts.py --download-keys $PROJECTID
python3 gen_sa_accounts.py --quick-setup 1 --new-only
A folder named accounts will be created which will contain keys for the Service Accounts.
Choose one of these methods
cd accounts
For Windows using PowerShell
$emails = Get-ChildItem .\**.json |Get-Content -Raw |ConvertFrom-Json |Select -ExpandProperty client_email >>emails.txt
For Linux
grep -oPh '"client_email": "\K[^"]+' *.json > emails.txt
cd ..
Then add emails from emails.txt to Google Group, after that add this Google Group to your Shared Drive and promote it to
manager and delete email.txt file from accounts folder
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
https://mongodb.com/
and sign-up.Database
under Deployment
Header, your created cluster will be there.Allow Access From Anywhere
and press on Add IP Address
without editing the ip, thenChoose a connection
, then press on Connect your application
. Choose Driver
*version
3.12 or later.connection string
and replace <password>
with the password of your user, then press close.To use list from multi TD/folder. Run driveid.py in your terminal and follow it. It will generate list_drives.txt
file or u can simply create list_drives.txt
file in working directory and fill it, check below format:
DriveName folderID/tdID or `root` IndexLink(if available)
DriveName folderID/tdID or `root` IndexLink(if available)
Example:
TD1 root https://example.dev
TD2 0AO1JDB1t3i5jUk9PVA https://example.dev
For using your premium accounts in yt-dlp or for protected Index Links, create .netrc file according to following
format:
Note: Create .netrc and not netrc, this file will be hidden, so view hidden files to edit it after creation.
Format:
machine host login username password my_password
Using Aria2c you can also use built in feature from bot with or without username. Here example for index link without
username.
machine example.workers.dev password index_password
Where host is the name of extractor (eg. instagram, Twitch). Multiple accounts of different hosts can be added each
separated by a new line.
Yt-dlp:
Authentication using cookies.txt file. CREATE IT IN INCOGNITO TAB.
If you feel like showing your appreciation for this project, then how about buying me a coffee.
Binance ID:
52187862
USDT Address:
TEzjjfkxLKQqndpsdpkA7jgiX7QQCL5p4f
Network:
TRC20
TRX Address:
TEzjjfkxLKQqndpsdpkA7jgiX7QQCL5p4f
Network:
TRC20
BTC Address:
17dkvxjqdc3yiaTs6dpjUB1TjV3tD7ScWe
ETH Address:
0xf798a8a1c72d593e16d8f3bb619ebd1a093c7309