arshsisodiya / helios-mirror

Telegram Mirror and Leech Bot
https://t.me/mirrorsociety
GNU General Public License v3.0
387 stars 964 forks source link
aria2c drive-api google-drive leech-bot mirror mirror-bot pyrogram python qbittorrent qbittorrent-nox qbittorrent-plugin search team-drive telegram-bot telegram-bot-api unlimited-storage

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

Features:

If you Like My work Star the repo and Follow me on Github

Features:

By Arsh

From Base and other Repositories

How to deploy?

Prerequisites

1. Installing requirements


2. Setting up config file

cp config_sample.env config.env

1. Required Fields

2. Optional Fields

Update

Mirror

Telegraph ui

GDTOT

Appdrive

Size Limits

qBittorrent/Aria2c

RSS

Private Files

MEGA

Buttons


3. Getting Google OAuth API credential file and token.pickle

NOTES

  1. Visit the Google Cloud Console
  2. Go to the OAuth Consent tab, fill it, and save.
  3. Go to the Credentials tab and click Create Credentials -> OAuth Client ID
  4. Choose Desktop and Create.
  5. Publish your OAuth consent screen App to prevent token.pickle from expire
  6. Use the download button to download your credentials.
  7. Move that file to the root of mirrorbot, and rename it to credentials.json
  8. Visit Google API page
  9. Search for Google Drive Api and enable it
  10. Finally, run the script to generate token.pickle file for Google Drive:
    pip3 install google-api-python-client google-auth-httplib2 google-auth-oauthlib
    python3 generate_drive_token.py

Deploying on VPS

IMPORTANT NOTES:

  1. You must set SERVER_PORT variable to 80 or any other port you want to use.
  2. To clear the container (this will not affect on the image):
    sudo docker container prune
  3. To delete the images:
    sudo docker image prune -a
  4. Check the number of processing units of your machine with nproc cmd and times it by 4, then edit AsyncIOThreadsCount in qBittorrent.conf.
  5. You can add CONFIG_FILE_URL variable using docker and docker-compose, google it.

Deploying on VPS Using Docker


Deploying on VPS Using docker-compose

NOTE: If you want to use port other than 80, change it in docker-compose.yml also.

sudo apt install docker-compose

Deploying on Heroku


Extras

Bot commands to be set in @BotFather

mirror -Mirror
zipmirror - Mirror and upload as zip
unzipmirror - Mirror and extract files
qbmirror - Mirror torrent using qBittorrent
qbzipmirror - Mirror torrent and upload as zip using qb
qbunzipmirror - Mirror torrent and extract files using qb
leech - Leech
zipleech - Leech and upload as zip
unzipleech - Leech and extract files
qbleech -  Leech torrent using qBittorrent
qbzipleech - Leech torrent and upload as zip using qb
qbunzipleech - Leech torrent and extract using qb
clone - Copy file/folder to Drive
count - Count file/folder of Drive
ytdl - Mirror yt-dlp supported link
ytdlzip -  Mirror yt-dlp supported link as zip
ytdlleech - Leech through yt-dlp supported link
ytdlzipleech - Leech yt-dlp support link as zip
leechset - Leech settings
setthumb - Set thumbnail
status - Get Mirror Status message
btsel - select files from torrent
rsslist -  List all subscribed rss feed info
rssget - Get specific No. of links from specific rss feed
rsssub - Subscribe new rss feed
rssunsub - Unsubscribe rss feed by title
rssset -  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 (Recommended)


Bittorrent Seed

Qbittorrent

Aria2c


Using Service Accounts for uploading to avoid user rate limit

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.

1. Generate Service Accounts. What is Service Account?

Let us create only the Service Accounts that we need.

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 or clone 2 TB from each file creator (uploader email).

Two methods to create service accounts

Choose one of these methods

1. Create Service Accounts in existed Project (Recommended Method)
2. Create Service Accounts in New Project
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.

2. Add Service Accounts

Two methods to add service accounts

Choose one of these methods

1. Add Them To Google Group then to Team Drive (Recommended)
2. Add Them To Team Drive Directly

Generate Database

1. Using Railway

2. Using Heroku PostgreSQL

3. Using ElephantSQL


Multi Search IDs

To use list from multi TD/folder. Run driveid.py in your terminal and follow it. It will generate drive_folder file or u can simply create drive_folder 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)

Yt-dlp and Aria2c Authentication Using .netrc File

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

Example:

machine instagram login anas.tayyar password mypassword

Instagram Note: You must login even if you want to download public posts and after first try you must confirm that this was you logged in from different ip(you can confirm from phone app).

Youtube Note: For youtube authentication use cookies.txt file.

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.


Base Repo Credit: Anasty