Aria mirror bot deploy on heroku
This is a Telegram Bot written in Python for mirroring files on the Internet to your Google Drive or Telegram. Based on python-aria-mirror-bot
root
or TeamDrive ID, folder ids will be listed with non-recursive method). Based on Sreeraj searchX-bot.amd64, arm64/v8, arm/v7, s390x
UPSTREAM_REPO
git clone https://github.com/vincreator/eunhamirror EunhaMirror/ && cd EunhaMirror
sudo apt install python3 python3-pip
sudo pacman -S docker python
pip3 install -r requirements-cli.txt
cp config_sample.env config.env
_____REMOVE_THIS_LINE_____=True
Int
, Bool
or List
.BOT_TOKEN
: The Telegram Bot Token that you got from @BotFather. Str
OWNER_ID
: The Telegram User ID (not username) of the Owner of the bot. Int
TELEGRAM_API
: This is to authenticate your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org. Int
TELEGRAM_HASH
: This is to authenticate your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org. Str
GDRIVE_ID
: This is the Folder/TeamDrive ID of the Google Drive Folder or root
to which you want to upload all the mirrors. Required for Google Drive
upload. Str
IS_TEAM_DRIVE
: Set True
if uploading to TeamDrive. Default is False
. Bool
DOWNLOAD_DIR
: The path to the local folder where the downloads should be downloaded to. Str
STATUS_UPDATE_INTERVAL
: Time in seconds after which the progress/status message will be updated. Recommended 10
seconds at least. Int
AUTO_DELETE_MESSAGE_DURATION
: Interval of time (in seconds), after which the bot deletes it’s message and command message which is expected to be viewed instantly. NOTE: Set to -1
to disable auto message deletion. Int
DATABASE_URL
: Your Mongo Database URL (Connection string). Follow this Generate Database to generate database. Data will be saved in Database: auth and sudo users, users settings including thumbnails for each user, rss data and incomplete tasks. NOTE: You can always edit all settings that saved in database from the official site -> (Browse collections). Str
AUTHORIZED_CHATS
: Fill user_id and chat_id of groups/users you want to authorize. Separate them by space. Int
SUDO_USERS
: Fill user_id of users whom you want to give sudo permission. Separate them by space. Int
IGNORE_PENDING_REQUESTS
: Ignore pending requests after restart. Default is False
. Bool
USE_SERVICE_ACCOUNTS
: Whether to use Service Accounts or not. For this to work see Using Service Accounts section below. Default is False
. Bool
INDEX_URL
: Refer to https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index. Str
STATUS_LIMIT
: Limit the no. of tasks shown in status message with buttons. NOTE: Recommended limit is 4
tasks. Int
STOP_DUPLICATE
: Bot will check file in Drive, if it is present in Drive, downloading or cloning will be stopped. (NOTE: File will be checked using filename not file hash, so this feature is not perfect yet). Default is False
. Bool
CMD_SUFFIX
: commands index number. This number will added at the end all commands. Str
|Int
TORRENT_TIMEOUT
: Timeout of dead torrents downloading with qBittorrent and Aria2c in seconds. Int
EXTENSION_FILTER
: File extensions that won’t upload/clone. Separate them by space. Str
INCOMPLETE_TASK_NOTIFIER
: Get incomplete task messages after restart. Require database and superGroup. Default is False
. Bool
UPTOBOX_TOKEN
: Uptobox token to mirror uptobox links. Get it from Uptobox Premium Account. str
TERABOX_COOKIES
: you need to add cookies velue of ndus only. get on cookie extension mozilla & Chrome. str
YT_DLP_QUALITY
: Default yt-dlp quality. Check all possible formats HERE. str
UPSTREAM_REPO
: 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. Str
.UPSTREAM_BRANCH
: Upstream branch for update. Default is master
. Str
LEECH_SPLIT_SIZE
: Size of split in bytes. Default is 2GB
. Default is 4GB
if your account is premium. Int
AS_DOCUMENT
: Default type of Telegram file upload. Default is False
mean as media. Bool
EQUAL_SPLITS
: Split files larger than LEECH_SPLIT_SIZE into equal parts size (Not working with zip cmd). Default is False
. Bool
MEDIA_GROUP
: View Uploaded splitted file parts in media group. Default is False
. Bool
.LEECH_FILENAME_PREFIX
: Add custom word to leeched file name. Str
DUMP_CHAT
: Chat ID. Upload files to specific chat. str
. NOTE: Only available for superGroup/channel. Add -100
before channel/superGroup id. In short don’t add bot id or your id!USER_SESSION_STRING
: To download/upload from your telegram account. If you own premium account. To generate session string use this command python3 generate_string_session.py
after mounting repo folder for sure. Str
. NOTE: You can’t use bot with private message. Use it with superGroup.BASE_URL
: Valid BASE URL where the bot is deployed to use qbittorrent web 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
). Str
SERVER_PORT
: Only For VPS, which is the BASE_URL_OF_BOT Port. Default is 80
. Int
WEB_PINCODE
: If empty or False
means no more pincode required while torrent files web selection. Bool
MaxConnecs
, decrease AsyncIOThreadsCount
in qbittorrent config and set limit of DiskWriteCacheSize
to 32
.RSS_DELAY
: Time in seconds for rss refresh interval. Recommended 900
second at least. Default is 900
in sec. Int
RSS_COMMAND
: Choose command for the desired action. Str
. NOTE: Don’t add /
at the beginning.RSS_CHAT_ID
: Chat ID where rss links will be sent. If using channel then add channel id. Add -100
before channel id. Int
RSS_USER_SESSION_STRING
: To send rss links from your telegram account. Instead of adding bot to channel then linking the channel to group to get rss link since bot will not read command from itself or other bot. To generate session string use this command python3 generate_string_session.py
after mounting repo folder for sure. Str
. NOTE: Don’t use same session string as USER_SESSION_STRING
.DATABASE_URL
and RSS_CHAT_ID
is required, otherwise all rss commands will not work. You must use bot in group. You can add the bot to a channel and link this channel to group so messages sent by bot to channel will be forwarded to group without using RSS_USER_STRING_SESSION
.MEGA_API_KEY
: Mega.nz API key to mirror mega.nz links. Get it from Mega SDK Page. Int
MEGA_EMAIL_ID
: E-Mail ID used to sign up on mega.nz for using premium account. Str
MEGA_PASSWORD
: Password for mega.nz account. Str
QUEUE_ALL
: Number of parallel tasks of downloads from (mega, telegram, yt-dlp, gdrive) + all 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. Int
. 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
: Number of parallel downloading tasks from mega, telegram, yt-dlp and gdrive. Int
QUEUE_UPLOAD
: Number of all parallel uploading tasks. Int
VIEW_LINK
: View Link button to open file Index Link in browser instead of direct download link, you can figure out if it’s compatible with your Index code or not, open any video from you Index and check if its URL ends with ?a=view
. Compatible with BhadooIndex Code. Default is False
. Bool
SEARCH_API_LINK
: Search api app link. Get your api from deploying this repository. Str
SEARCH_LIMIT
: Search limit for search api, limit for each site and not overall result limit. Default is zero (Default api limit for each site). Int
SEARCH_PLUGINS
: 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). List
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
sudo dockerd
sudo docker build . -t EunhaMirror
sudo docker run -p 80:80 EunhaMirror
sudo docker ps
sudo docker stop id
sudo apt install docker-compose
sudo docker-compose up
sudo docker-compose up --build
sudo docker-compose stop
sudo docker-compose start
SERVER_PORT
variable to any port you want to use. Default is 80
.sudo docker container prune
sudo docker image prune -a
nproc
cmd and times it by 4, then edit AsyncIOThreadsCount
in qBittorrent.conf.mirror - or /m Mirror
zipmirror - or /zm Mirror and upload as zip
unzipmirror - or /uzm Mirror and extract files
qbmirror - or /qm Mirror torrent using qBittorrent
qbzipmirror - or /qzm Mirror torrent and upload as zip using qb
qbunzipmirror - or /quzm Mirror torrent and extract files using qb
leech - or /l Leech
zipleech - or /zl Leech and upload as zip
unzipleech - or /uzl Leech and extract files
qbleech - or /ql Leech torrent using qBittorrent
qbzipleech - or /qzl Leech torrent and upload as zip using qb
qbunzipleech - or /quzl Leech torrent and extract using qb
clone - Copy file/folder to Drive
count - Count file/folder of Drive
ytdl - or /y Mirror yt-dlp supported link
ytdlzip - or /yz Mirror yt-dlp supported link as zip
ytdlleech - or /yl Leech through yt-dlp supported link
ytdlzipleech - or /yzl Leech yt-dlp support link as zip
usetting - users settings
bsetting - bot settings
status - Get Mirror Status message
btsel - select files from torrent
rsslist - or /rl List all subscribed rss feed info
rssget - or /rg Get specific No. of links from specific rss feed
rsssub - or /rs Subscribe new rss feed
rssunsub - or /rus Unsubscribe rss feed by title
rssset - or /rst Rss Settings
list - Search files in Drive
search - Search for torrents with API
cancel - Cancel a task
cancelall - Cancel all tasks
del - Delete file/folder from Drive
log - Get the Bot Log
shell - Run commands in Shell
restart - Restart the Bot
stats - Bot Usage Stats
ping - Ping the Bot
help - All cmds with description
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 this private repository, so your private files will be overwritten from this repository. Also if you are using database for private files, then all files from database will override the private files that added before deploying or from private UPSTREAM_REPO
.UPSTREAM_REPO
with the official repository link, then be carefull incase any change in requirements.txt your bot will not start after restart. In this case you need to deploy again with updated code to install the new requirements or simply by changing the UPSTREAM_REPO
to you fork link with that old updates.UPSTREAM_REPO
with your fork link be carefull also if you fetched the commits from the official repository.UPSTREAM_REPO
will take affect only after restart.d:ratio:time
perfix along with leech or mirror cmd.d
perfix alone will lead to use global options for aria2c or qbittorrent.MaxRatio
and GlobalMaxSeedingMinutes
in qbittorrent.conf, -1
means no limit, but you can cancel manually.MaxRatioAction
.--seed-ratio
(0 means no limit) and --seed-time
(0 means no seed) in aria.sh.USE_SERVICE_ACCOUNTS
= “True” in config file or environment variables.python3 gen_sa_accounts.py --download-keys $PROJECTID
2TB/DAY
from each file creator (uploader account), so if you got error userRateLimitExceeded
that doesn’t mean your limit exceeded but file creator limit have been exceeded which is 2TB/DAY
.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
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 ..
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 Acces From Anywhere
and press on Add IP Address
without editing the ip, then create user.Choose a connection
, then press on Connect your application
. Choose Driver
python and version
3.6 or later.connection string
and replace <password>
with the password of your user, then press close.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)
TD1 root https://example.dev
TD2 0AO1JDB1t3i5jUk9PVA https://example.dev
machine host login username password my_password
machine instagram login anas.tayyar password mypassword
youtube
authentication use cookies.txt file.machine example.workers.dev password index_password