From 8bd01276bec5c4a50b07531835700a152dacb8a0 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Wed, 3 Jun 2020 11:32:09 +0530
Subject: [PATCH 001/190] Add ability to login to mega account for premium
accounts
Signed-off-by: lzzy12
---
README.md | 2 ++
bot/__init__.py | 13 +++++++--
.../download_utils/mega_downloader.py | 27 +++++++++++++------
config_sample.env | 2 ++
4 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index b402db9eb..5415f8f7b 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,8 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
- **USER_SESSION_STRING** : Session string generated by running:
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
+- **MEGA_EMAIL_ID**: You email id you used to sign up on mega.nz for using premium accounts (Leave th)
+- **
```
python3 generate_string_session.py
```
diff --git a/bot/__init__.py b/bot/__init__.py
index c08dee660..76fca77e4 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -83,8 +83,17 @@ def getConfig(name: str):
try:
MEGA_API_KEY = getConfig('MEGA_API_KEY')
except KeyError:
- logging.warning('MEGA Api key not provided!')
- MEGA_API_KEY = None
+ logging.warning('MEGA API KEY not provided!')
+
+try:
+ MEGA_EMAIL_ID = getConfig('MEGA_EMAIL_ID')
+ MEGA_PASSWORD = getConfig('MEGA_PASSWORD')
+ if len(MEGA_EMAIL_ID) == 0 or len(MEGA_PASSWORD) == 0:
+ raise KeyError
+except KeyError:
+ logging.warning('MEGA Credentials not provided!')
+ MEGA_EMAIL_ID = None
+ MEGA_PASSWORD = None
try:
INDEX_URL = getConfig('INDEX_URL')
if len(INDEX_URL) == 0:
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 4714b113c..27d1efdcf 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -1,10 +1,15 @@
-from bot import LOGGER, MEGA_API_KEY, download_dict_lock, download_dict
+from bot import LOGGER, MEGA_API_KEY, download_dict_lock, download_dict, MEGA_EMAIL_ID, MEGA_PASSWORD
import threading
from mega import (MegaApi, MegaListener, MegaRequest, MegaTransfer, MegaError)
from bot.helper.telegram_helper.message_utils import update_all_messages
import os
from bot.helper.mirror_utils.status_utils.mega_download_status import MegaDownloadStatus
+
+class MegaDownloaderException(Exception):
+ pass
+
+
class MegaAppListener(MegaListener):
def __init__(self, continue_event: threading.Event, listener):
@@ -31,7 +36,7 @@ def name(self):
"""Returns name of the download"""
return self.__name
- def setValues(self,name,size,gid):
+ def setValues(self, name, size, gid):
self.__name = name
self.__size = size
self.gid = gid
@@ -74,11 +79,11 @@ def onTransferStart(self, api: MegaApi, transfer: MegaTransfer):
def onTransferUpdate(self, api: MegaApi, transfer: MegaTransfer):
if self.is_cancelled:
- api.cancelTransfer(transfer,None)
+ api.cancelTransfer(transfer, None)
self.__speed = transfer.getSpeed()
self.__bytes_transferred = transfer.getTransferredBytes()
- def onTransferFinish(self, api: MegaApi, transfer : MegaTransfer, error):
+ def onTransferFinish(self, api: MegaApi, transfer: MegaTransfer, error):
try:
LOGGER.info(f'Transfer finished ({transfer}); Result: {transfer.getFileName()}')
if str(error) != "No error" and self.is_cancelled:
@@ -98,7 +103,8 @@ def onTransferTemporaryError(self, api, transfer, error):
def cancel_download(self):
self.is_cancelled = True
-class AsyncExecutor(object):
+
+class AsyncExecutor:
def __init__(self):
self.continue_event = threading.Event()
@@ -108,16 +114,21 @@ def do(self, function, args):
function(*args)
self.continue_event.wait()
+
class MegaDownloadHelper:
def __init__(self):
pass
def add_download(self, mega_link: str, path: str, listener):
+ if MEGA_API_KEY is None:
+ raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror mega links')
executor = AsyncExecutor()
api = MegaApi(MEGA_API_KEY, None, None, 'telegram-mirror-bot')
mega_listener = MegaAppListener(executor.continue_event, listener)
os.makedirs(path)
api.addListener(mega_listener)
+ if MEGA_EMAIL_ID is not None and MEGA_PASSWORD is not None:
+ executor.do(api.login, (MEGA_EMAIL_ID, MEGA_PASSWORD))
executor.do(api.getPublicNode, (mega_link,))
node = mega_listener.node
if node is None:
@@ -125,8 +136,8 @@ def add_download(self, mega_link: str, path: str, listener):
node = mega_listener.node
if mega_listener.error is not None:
return listener.onDownloadError(str(mega_listener.error))
- mega_listener.setValues(node.getName(),api.getSize(node),mega_link.split("!",1)[-1].split("!",1)[0])
+ mega_listener.setValues(node.getName(), api.getSize(node), mega_link.split("!", 1)[-1].split("!", 1)[0])
with download_dict_lock:
- download_dict[listener.uid] = MegaDownloadStatus(mega_listener,listener)
- threading.Thread(target=executor.do,args=(api.startDownload,(node,path))).start()
+ download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
+ threading.Thread(target=executor.do, args=(api.startDownload, (node, path))).start()
update_all_messages()
diff --git a/config_sample.env b/config_sample.env
index 453c888c9..67ff99cd0 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -15,3 +15,5 @@ TELEGRAM_API =
TELEGRAM_HASH = ""
USE_SERVICE_ACCOUNTS = ""
MEGA_API_KEY = ""
+MEGA_EMAIL_ID = ""
+MEGA_PASSWORD = ""
\ No newline at end of file
From 4754fb7a231828e8e6c303b62e8b3981717f2676 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Wed, 3 Jun 2020 11:35:02 +0530
Subject: [PATCH 002/190] Fixed docs
Signed-off-by: lzzy12
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 5415f8f7b..31f3b5256 100644
--- a/README.md
+++ b/README.md
@@ -61,8 +61,8 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
- **USER_SESSION_STRING** : Session string generated by running:
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
-- **MEGA_EMAIL_ID**: You email id you used to sign up on mega.nz for using premium accounts (Leave th)
-- **
+- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
+- **MEGA_PASSWORD**: Your password for your mega.nz account
```
python3 generate_string_session.py
```
@@ -73,7 +73,7 @@ Note: You can limit maximum concurrent downloads by changing the value of MAX_CO
- Visit the [Google Cloud Console](https://console.developers.google.com/apis/credentials)
- Go to the OAuth Consent tab, fill it, and save.
- Go to the Credentials tab and click Create Credentials -> OAuth Client ID
-- Choose Other and Create.
+- Choose Desktop and Create.
- Use the download button to download your credentials.
- Move that file to the root of mirror-bot, and rename it to credentials.json
- Visit [Google API page](https://console.developers.google.com/apis/library)
From 8b3805c55a76b5376bf855660751a70263e3fa0a Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Fri, 5 Jun 2020 12:53:17 +0530
Subject: [PATCH 003/190] Use prebuilt Docker image for mega-sdk
Signed-off-by: lzzy12
---
Dockerfile | 19 ++-----------------
extract | 10 +++++-----
2 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 4c89c261c..8cc39e3b9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,25 +1,10 @@
-FROM ubuntu:18.04
+FROM lzzy12/mega-sdk-python:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
RUN apt-get -qq update
-RUN apt-get -qq install -y python3 python3-pip rar unzip git aria2 g++ gcc autoconf automake \
- m4 libtool qt4-qmake make libqt4-dev libcurl4-openssl-dev \
- libcrypto++-dev libsqlite3-dev libc-ares-dev \
- libsodium-dev libnautilus-extension-dev \
- libssl-dev libfreeimage-dev swig curl pv jq ffmpeg locales python3-lxml
-
-# Installing mega sdk python binding
-ENV MEGA_SDK_VERSION '3.6.4'
-RUN git clone https://github.com/meganz/sdk.git sdk
-WORKDIR sdk
-RUN git checkout v$MEGA_SDK_VERSION && ./autogen.sh && \
- ./configure --disable-silent-rules --enable-python --disable-examples && \
- make -j$(nproc --all) && cd bindings/python/ && \
- python setup.py bdist_wheel && cd dist/ && \
- pip install --no-cache-dir megasdk-$MEGA_SDK_VERSION-*.whl
-
+RUN apt-get -qq install -y p7zip-full aria2 curl pv jq ffmpeg locales python3-lxml
COPY requirements.txt .
COPY extract /usr/local/bin
diff --git a/extract b/extract
index db113eb88..8a31a9e7d 100755
--- a/extract
+++ b/extract
@@ -7,7 +7,7 @@ fi
extract () {
arg="$1"
- cd $(dirname "$arg")
+ cd "$(dirname "$arg")" || exit
case "$arg" in
*.tar.bz2)
tar xjf "$arg" --one-top-level ;;
@@ -20,15 +20,15 @@ extract () {
*.tgz) tar xzf "$arg" --one-top-level ;;
*.zip)
a_dir=`expr "$arg" : '\(.*\).zip'`
- unzip "$arg" -d "$a_dir" ;;
+ 7z "$arg" -o"$a_dir" ;;
*.Z) uncompress "$arg" ;;
- *.rar)
+ *.rar)
a_dir=`expr "$arg" : '\(.*\).rar'` ;
mkdir "$a_dir" ;
- rar x "$arg" "$a_dir" ;; # 'rar' must to be installed
+ 7z x "$arg" -o"$a_dir" ;;
*) echo "'$arg' cannot be extracted via extract()" ;;
esac
- cd -
+ cd - || exit
}
extract "$1"
From 3217b67df03022655899ac821e90e05fecd4bdbd Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Fri, 5 Jun 2020 13:15:00 +0530
Subject: [PATCH 004/190] Fixup for meganz login
Signed-off-by: lzzy12
---
.../mirror_utils/download_utils/mega_downloader.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 27d1efdcf..a7a52e160 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -11,6 +11,8 @@ class MegaDownloaderException(Exception):
class MegaAppListener(MegaListener):
+ _NO_EVENT_ON = (MegaRequest.TYPE_LOGIN,
+ MegaRequest.TYPE_FETCH_NODES)
def __init__(self, continue_event: threading.Event, listener):
self.continue_event = continue_event
@@ -58,15 +60,14 @@ def onRequestFinish(self, api, request, error):
.format(request, error))
request_type = request.getType()
- if request_type == MegaRequest.TYPE_GET_PUBLIC_NODE:
- self.node = request.getPublicMegaNode()
if request_type == MegaRequest.TYPE_LOGIN:
- LOGGER.info("Fetching Nodes.")
api.fetchNodes()
- if request_type == MegaRequest.TYPE_FETCH_NODES:
+ elif request_type == MegaRequest.TYPE_GET_PUBLIC_NODE:
+ self.node = request.getPublicMegaNode()
+ elif request_type == MegaRequest.TYPE_FETCH_NODES:
LOGGER.info("Fetching Root Node.")
self.node = api.getRootNode()
- if request_type != MegaRequest.TYPE_LOGIN:
+ if request_type not in self._NO_EVENT_ON:
self.continue_event.set()
def onRequestTemporaryError(self, api, request, error: MegaError):
From c791b39785b222783ebeefee5338e7ee86957682 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Fri, 5 Jun 2020 13:20:40 +0530
Subject: [PATCH 005/190] Revert "Improved upload progress implementation"
This reverts commit 0f7b79f7a4fbc0e830af668509bc8400d7da128b.
---
.../mirror_utils/upload_utils/gdriveTools.py | 48 ++++++++++++-------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 5f30a5c58..480ddc381 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -39,18 +39,21 @@ def __init__(self, name=None, listener=None):
self.__service = self.authorize()
self.__listener = listener
self._file_uploaded_bytes = 0
- self.__uploaded_bytes = 0
+ self.uploaded_bytes = 0
+ self.UPDATE_INTERVAL = 5
self.start_time = 0
+ self.total_time = 0
+ self._should_update = True
+ self.is_uploading = True
self.is_cancelled = False
+ self.status = None
+ self.updater = None
self.name = name
- self.transferred_size = 0
+ self.update_interval = 3
def cancel(self):
self.is_cancelled = True
-
- @property
- def uploaded_bytes(self):
- return self.__uploaded_bytes
+ self.is_uploading = False
def speed(self):
"""
@@ -58,7 +61,7 @@ def speed(self):
:return: Upload speed in bytes/second
"""
try:
- return self.uploaded_bytes / (time.time() - self.start_time)
+ return self.uploaded_bytes / self.total_time
except ZeroDivisionError:
return 0
@@ -66,7 +69,7 @@ def speed(self):
def getIdFromUrl(link: str):
if "folders" in link or "file" in link:
regex = r"https://drive\.google\.com/(drive)?/?u?/?\d?/?(mobile)?/?(file)?(folders)?/?d?/([-\w]+)[?+]?/?(w+)?"
- res = re.search(regex, link)
+ res = re.search(regex,link)
if res is None:
raise IndexError("GDrive ID not found.")
return res.group(5)
@@ -75,6 +78,14 @@ def getIdFromUrl(link: str):
@retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(5),
retry=retry_if_exception_type(HttpError), before=before_log(LOGGER, logging.DEBUG))
+ def _on_upload_progress(self):
+ if self.status is not None:
+ chunk_size = self.status.total_size * self.status.progress() - self._file_uploaded_bytes
+ self._file_uploaded_bytes = self.status.total_size * self.status.progress()
+ LOGGER.debug(f'Uploading {self.name}, chunk size: {get_readable_file_size(chunk_size)}')
+ self.uploaded_bytes += chunk_size
+ self.total_time += self.update_interval
+
def __upload_empty_file(self, path, file_name, mime_type, parent_id=None):
media_body = MediaFileUpload(path,
mimetype=mime_type,
@@ -144,14 +155,12 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
drive_file = self.__service.files().create(supportsTeamDrives=True,
body=file_metadata, media_body=media_body)
response = None
- last_uploaded = 0
while response is None:
if self.is_cancelled:
return None
try:
- status, response = drive_file.next_chunk()
+ self.status, response = drive_file.next_chunk()
except HttpError as err:
- status = None
if err.resp.get('content-type', '').startswith('application/json'):
reason = json.loads(err.content).get('error').get('errors')[0].get('reason')
if reason == 'userRateLimitExceeded' or reason == 'dailyLimitExceeded':
@@ -161,10 +170,6 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
self.upload_file(file_path, file_name, mime_type, parent_id)
else:
raise err
- if status is not None:
- chunk_size = status.total_size * status.progress() - last_uploaded
- last_uploaded = status.total_size * status.progress()
- self.__uploaded_bytes += chunk_size
self._file_uploaded_bytes = 0
# Insert new permissions
if not IS_TEAM_DRIVE:
@@ -175,11 +180,14 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
return download_url
def upload(self, file_name: str):
+ if USE_SERVICE_ACCOUNTS:
+ self.service_account_count = len(os.listdir("accounts"))
self.__listener.onUploadStarted()
file_dir = f"{DOWNLOAD_DIR}{self.__listener.message.message_id}"
file_path = f"{file_dir}/{file_name}"
LOGGER.info("Uploading File: " + file_path)
self.start_time = time.time()
+ self.updater = setInterval(self.update_interval, self._on_upload_progress)
if os.path.isfile(file_path):
try:
mime_type = get_mime_type(file_path)
@@ -196,6 +204,8 @@ def upload(self, file_name: str):
LOGGER.error(err)
self.__listener.onUploadError(str(err))
return
+ finally:
+ self.updater.cancel()
else:
try:
dir_id = self.create_directory(os.path.basename(os.path.abspath(file_name)), parent_id)
@@ -213,6 +223,8 @@ def upload(self, file_name: str):
LOGGER.error(err)
self.__listener.onUploadError(str(err))
return
+ finally:
+ self.updater.cancel()
LOGGER.info(download_dict)
self.__listener.onUploadComplete(link)
LOGGER.info("Deleting downloaded file/folder..")
@@ -226,7 +238,7 @@ def copyFile(self, file_id, dest_id):
}
try:
- res = self.__service.files().copy(supportsAllDrives=True, fileId=file_id, body=body).execute()
+ res = self.__service.files().copy(supportsAllDrives=True,fileId=file_id,body=body).execute()
return res
except HttpError as err:
if err.resp.get('content-type', '').startswith('application/json'):
@@ -235,7 +247,7 @@ def copyFile(self, file_id, dest_id):
if USE_SERVICE_ACCOUNTS:
self.switchServiceAccount()
LOGGER.info(f"Got: {reason}, Trying Again.")
- self.copyFile(file_id, dest_id)
+ self.copyFile(file_id,dest_id)
else:
raise err
@@ -243,7 +255,7 @@ def clone(self, link):
self.transferred_size = 0
try:
file_id = self.getIdFromUrl(link)
- except (KeyError, IndexError):
+ except (KeyError,IndexError):
msg = "Google drive ID could not be found in the provided link"
return msg
msg = ""
From c4c7575000814a408951f9e048fc64fa6db140ed Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Fri, 5 Jun 2020 14:01:36 +0530
Subject: [PATCH 006/190] Generate our own gid for mega mirrors
Signed-off-by: lzzy12
---
.../mirror_utils/download_utils/mega_downloader.py | 6 ++++--
.../mirror_utils/status_utils/mega_download_status.py | 3 +--
bot/modules/mirror.py | 11 ++++++-----
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index a7a52e160..1c8c9874a 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -4,7 +4,8 @@
from bot.helper.telegram_helper.message_utils import update_all_messages
import os
from bot.helper.mirror_utils.status_utils.mega_download_status import MegaDownloadStatus
-
+import random
+import string
class MegaDownloaderException(Exception):
pass
@@ -137,7 +138,8 @@ def add_download(self, mega_link: str, path: str, listener):
node = mega_listener.node
if mega_listener.error is not None:
return listener.onDownloadError(str(mega_listener.error))
- mega_listener.setValues(node.getName(), api.getSize(node), mega_link.split("!", 1)[-1].split("!", 1)[0])
+ gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
+ mega_listener.setValues(node.getName(), api.getSize(node), gid)
with download_dict_lock:
download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
threading.Thread(target=executor.do, args=(api.startDownload, (node, path))).start()
diff --git a/bot/helper/mirror_utils/status_utils/mega_download_status.py b/bot/helper/mirror_utils/status_utils/mega_download_status.py
index bb5cf7311..cc7f7b435 100644
--- a/bot/helper/mirror_utils/status_utils/mega_download_status.py
+++ b/bot/helper/mirror_utils/status_utils/mega_download_status.py
@@ -5,7 +5,7 @@
class MegaDownloadStatus(Status):
- def __init__(self, obj,listener):
+ def __init__(self, obj, listener):
self.uid = obj.uid
self.listener = listener
self.obj = obj
@@ -22,7 +22,6 @@ def progress_raw(self):
def progress(self):
"""Progress of download in percentage"""
return f"{self.progress_raw()}%"
-
def status(self) -> str:
return MirrorStatus.STATUS_DOWNLOADING
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index a6d2cd09d..dc1c3fa8a 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -26,7 +26,7 @@
class MirrorListener(listeners.MirrorListeners):
- def __init__(self, bot, update, isTar=False,tag=None, extract=False):
+ def __init__(self, bot, update, isTar=False, tag=None, extract=False):
super().__init__(bot, update)
self.isTar = isTar
self.tag = tag
@@ -66,7 +66,7 @@ def onDownloadComplete(self):
return
elif self.extract:
download.is_extracting = True
-
+
path = fs_utils.get_base_name(m_path)
if path != "unsupported":
LOGGER.info(
@@ -171,6 +171,7 @@ def onUploadError(self, error):
else:
update_all_messages()
+
def _mirror(bot, update, isTar=False, extract=False):
message_args = update.message.text.split(' ')
try:
@@ -214,9 +215,9 @@ def _mirror(bot, update, isTar=False, extract=False):
listener = MirrorListener(bot, update, isTar, tag, extract)
if bot_utils.is_mega_link(link):
mega_dl = MegaDownloadHelper()
- mega_dl.add_download(link,f'{DOWNLOAD_DIR}/{listener.uid}/',listener)
+ mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
else:
- ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/',listener)
+ ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
@@ -234,7 +235,7 @@ def tar_mirror(update, context):
@run_async
def unzip_mirror(update, context):
- _mirror(context.bot,update, extract=True)
+ _mirror(context.bot, update, extract=True)
mirror_handler = CommandHandler(BotCommands.MirrorCommand, mirror,
From cfe636f5ceb35f476a62cef4881a9406a8daefaa Mon Sep 17 00:00:00 2001
From: Shivam Jha
Date: Mon, 8 Jun 2020 20:24:26 +0530
Subject: [PATCH 007/190] Add missing x argument
---
extract | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extract b/extract
index 8a31a9e7d..f124d7c9b 100755
--- a/extract
+++ b/extract
@@ -20,7 +20,7 @@ extract () {
*.tgz) tar xzf "$arg" --one-top-level ;;
*.zip)
a_dir=`expr "$arg" : '\(.*\).zip'`
- 7z "$arg" -o"$a_dir" ;;
+ 7z x "$arg" -o"$a_dir" ;;
*.Z) uncompress "$arg" ;;
*.rar)
a_dir=`expr "$arg" : '\(.*\).rar'` ;
From 87cc9206fa17aa9b8092b20e29a284fc8952a3d7 Mon Sep 17 00:00:00 2001
From: Shivam Jha
Date: Tue, 9 Jun 2020 19:42:06 +0530
Subject: [PATCH 008/190] Use local fork of youtube-dl for hotstar fix
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 1699c9b6d..078a15ebb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,4 +10,4 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram>=0.16.0,<0.16.10
TgCrypto>=1.1.1,<1.1.10
-youtube-dl
+git+git://github.com/lzzy12/youtube-dl@d7c2b43#youtube_dl
From 18b4bb976e63ed389aee5b0b97e9292c7f47984b Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 15 Jun 2020 13:25:37 +0530
Subject: [PATCH 009/190] Added CPU and Disk Usage to the Status Message
---
bot/helper/telegram_helper/message_utils.py | 5 +++++
requirements.txt | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 9d3eb02c5..c2a503213 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -1,6 +1,7 @@
from telegram.message import Message
from telegram.update import Update
import time
+import psutil
from bot import AUTO_DELETE_MESSAGE_DURATION, LOGGER, bot, \
status_reply_dict, status_reply_dict_lock
from bot.helper.ext_utils.bot_utils import get_readable_message
@@ -64,6 +65,8 @@ def delete_all_messages():
def update_all_messages():
msg = get_readable_message()
+ msg += f"CPU: {psutil.cpu_percent()} %" \
+ f" DISK: {psutil.disk_usage('/').percent} %"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -76,6 +79,8 @@ def update_all_messages():
def sendStatusMessage(msg, bot):
progress = get_readable_message()
+ progress += f"CPU: {psutil.cpu_percent()} %" \
+ f" DISK: {psutil.disk_usage('/').percent} %"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:
diff --git a/requirements.txt b/requirements.txt
index 3afe08e22..984c966ed 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
requests
-python-telegram-bot==12.6.1
+python-telegram-bot==12.6.1
+psutil
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
google-auth-oauthlib>=0.4.1,<0.10.0
From 852394afef789c038f6159ce1df5a1bdae7e9d46 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 15 Jun 2020 13:36:46 +0530
Subject: [PATCH 010/190] show peers and seeders for .torrents files too
---
bot/helper/ext_utils/bot_utils.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index a015fb79f..470c820e8 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -93,14 +93,17 @@ def get_readable_message():
msg += f"{download.name()} - "
msg += download.status()
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
- msg += f"\n{get_progress_bar_string(download)} {download.progress()} of " \
- f"{download.size()}" \
- f" at {download.speed()}, ETA: {download.eta()} "
+ msg += f"\n{get_progress_bar_string(download)} {download.progress()} | " \
+ f"{get_readable_file_size(download.processed_bytes())}/{download.size()}" \
+ f"\nSpeed {download.speed()}, \nETA: {download.eta()} "
+ # if hasattr(download, 'is_torrent'):
+ try:
+ msg += f"\n| P: {download.aria_download().connections} " \
+ f"| S: {download.aria_download().num_seeders}"
+ except:
+ pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- if hasattr(download, 'is_torrent'):
- msg += f"| P: {download.aria_download().connections} " \
- f"| S: {download.aria_download().num_seeders}"
- msg += f"\nGID: {download.gid()}"
+ msg += f"\nGID: {download.gid()}"
msg += "\n\n"
return msg
From c29de8e940d3a25a97a2132b9be9c585034c21d9 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 15 Jun 2020 14:21:42 +0530
Subject: [PATCH 011/190] Fix SSL handsake error
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 574b21c75..d0cb89126 100755
--- a/aria.sh
+++ b/aria.sh
@@ -1,7 +1,7 @@
export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
export MAX_CONCURRENT_DOWNLOADS=4
-aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 \
+aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
--max-connection-per-server=10 --rpc-max-request-size=1024M \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
--follow-torrent=mem --split=10 \
From c409726f71210ec0b071e770b861f089a3d88481 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 15 Jun 2020 21:54:55 +0530
Subject: [PATCH 012/190] Changed Progress Bar
---
bot/helper/ext_utils/bot_utils.py | 34 +++++++++++++++----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 470c820e8..cbd6c51d0 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -13,17 +13,17 @@
class MirrorStatus:
- STATUS_UPLOADING = "Uploading"
- STATUS_DOWNLOADING = "Downloading"
- STATUS_WAITING = "Queued"
- STATUS_FAILED = "Failed. Cleaning download"
- STATUS_CANCELLED = "Cancelled"
- STATUS_ARCHIVING = "Archiving"
- STATUS_EXTRACTING = "Extracting"
+ STATUS_UPLOADING = "Uploading...📤"
+ STATUS_DOWNLOADING = "Downloading...📥"
+ STATUS_WAITING = "Queued...📝"
+ STATUS_FAILED = "Failed 🚫. Cleaning download"
+ STATUS_CANCELLED = "Cancelled ❎"
+ STATUS_ARCHIVING = "Archiving...🔐"
+ STATUS_EXTRACTING = "Extracting...📂"
PROGRESS_MAX_SIZE = 100 // 8
-PROGRESS_INCOMPLETE = ['▏', '▎', '▍', '▌', '▋', '▊', '▉']
+PROGRESS_INCOMPLETE = ['●', '●', '●', '●', '●', '●', '●']
SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
@@ -78,10 +78,10 @@ def get_progress_bar_string(status):
p = min(max(p, 0), 100)
cFull = p // 8
cPart = p % 8 - 1
- p_str = '█' * cFull
+ p_str = '●' * cFull
if cPart >= 0:
p_str += PROGRESS_INCOMPLETE[cPart]
- p_str += ' ' * (PROGRESS_MAX_SIZE - cFull)
+ p_str += '○' * (PROGRESS_MAX_SIZE - cFull)
p_str = f"[{p_str}]"
return p_str
@@ -90,16 +90,16 @@ def get_readable_message():
with download_dict_lock:
msg = ""
for download in list(download_dict.values()):
- msg += f"{download.name()} - "
- msg += download.status()
+ msg += f"Filename : {download.name()}"
+ msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
- msg += f"\n{get_progress_bar_string(download)} {download.progress()} | " \
- f"{get_readable_file_size(download.processed_bytes())}/{download.size()}" \
- f"\nSpeed {download.speed()}, \nETA: {download.eta()} "
+ msg += f"\n{get_progress_bar_string(download)} {download.progress()}" \
+ f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}" \
+ f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
- msg += f"\n| P: {download.aria_download().connections} " \
- f"| S: {download.aria_download().num_seeders}"
+ msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
+ f" & Peers : {download.aria_download().connections}"
except:
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
From 3720eacf135a7bb64b8bd541726ef77ebffca58b Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Thu, 18 Jun 2020 12:57:31 +0530
Subject: [PATCH 013/190] Optimize Clone implementation
---
.../mirror_utils/upload_utils/gdriveTools.py | 50 ++++++++++++-------
bot/modules/clone.py | 7 +--
2 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 480ddc381..0fe2f1950 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -6,6 +6,7 @@
import re
import json
import requests
+import logging
from google.auth.transport.requests import Request
from google.oauth2 import service_account
@@ -16,7 +17,7 @@
from tenacity import *
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
- USE_SERVICE_ACCOUNTS
+ USE_SERVICE_ACCOUNTS, download_dict
from bot.helper.ext_utils.bot_utils import *
from bot.helper.ext_utils.fs_utils import get_mime_type
@@ -167,7 +168,7 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
if USE_SERVICE_ACCOUNTS:
self.switchServiceAccount()
LOGGER.info(f"Got: {reason}, Trying Again.")
- self.upload_file(file_path, file_name, mime_type, parent_id)
+ return self.upload_file(file_path, file_name, mime_type, parent_id)
else:
raise err
self._file_uploaded_bytes = 0
@@ -247,10 +248,37 @@ def copyFile(self, file_id, dest_id):
if USE_SERVICE_ACCOUNTS:
self.switchServiceAccount()
LOGGER.info(f"Got: {reason}, Trying Again.")
- self.copyFile(file_id,dest_id)
+ return self.copyFile(file_id,dest_id)
else:
raise err
+ @retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(5),
+ retry=retry_if_exception_type(HttpError), before=before_log(LOGGER, logging.DEBUG))
+ def getFileMetadata(self,file_id):
+ return self.__service.files().get(supportsAllDrives=True, fileId=file_id,
+ fields="name,id,mimeType,size").execute()
+
+ @retry(wait=wait_exponential(multiplier=2, min=3, max=6), stop=stop_after_attempt(5),
+ retry=retry_if_exception_type(HttpError), before=before_log(LOGGER, logging.DEBUG))
+ def getFilesByFolderId(self,folder_id):
+ page_token = None
+ q = f"'{folder_id}' in parents"
+ files = []
+ while True:
+ response = self.__service.files().list(supportsTeamDrives=True,
+ includeTeamDriveItems=True,
+ q=q,
+ spaces='drive',
+ pageSize=200,
+ fields='nextPageToken, files(id, name, mimeType,size)',
+ pageToken=page_token).execute()
+ for file in response.get('files', []):
+ files.append(file)
+ page_token = response.get('nextPageToken', None)
+ if page_token is None:
+ break
+ return files
+
def clone(self, link):
self.transferred_size = 0
try:
@@ -304,23 +332,9 @@ def clone(self, link):
return msg
def cloneFolder(self, name, local_path, folder_id, parent_id):
- page_token = None
- q = f"'{folder_id}' in parents"
- files = []
LOGGER.info(f"Syncing: {local_path}")
+ files = self.getFilesByFolderId(folder_id)
new_id = None
- while True:
- response = self.__service.files().list(supportsTeamDrives=True,
- includeTeamDriveItems=True,
- q=q,
- spaces='drive',
- fields='nextPageToken, files(id, name, mimeType,size)',
- pageToken=page_token).execute()
- for file in response.get('files', []):
- files.append(file)
- page_token = response.get('nextPageToken', None)
- if page_token is None:
- break
if len(files) == 0:
return parent_id
for file in files:
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index 407e3532a..47202ffba 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -1,12 +1,13 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot.helper.telegram_helper.message_utils import *
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
+from bot.helper.ext_utils.bot_utils import new_thread
from bot import dispatcher
-@run_async
+@new_thread
def cloneNode(update,context):
args = update.message.text.split(" ",maxsplit=1)
if len(args) > 1:
@@ -17,7 +18,7 @@ def cloneNode(update,context):
deleteMessage(context.bot,msg)
sendMessage(result,context.bot,update)
else:
- sendMessage("Provide G-Drive Shareable Link to Clone.",bot,update)
+ sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
clone_handler = CommandHandler(BotCommands.CloneCommand,cloneNode,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(clone_handler)
\ No newline at end of file
From c6a430a44d60683cca0c72b46975fb2cbf9a0127 Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Thu, 18 Jun 2020 12:59:52 +0530
Subject: [PATCH 014/190] Handle more exceptions
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 0fe2f1950..61e611a73 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -289,8 +289,7 @@ def clone(self, link):
msg = ""
LOGGER.info(f"File ID: {file_id}")
try:
- meta = self.__service.files().get(supportsAllDrives=True, fileId=file_id,
- fields="name,id,mimeType,size").execute()
+ meta = self.getFileMetadata(file_id)
except Exception as e:
return f"{str(e).replace('>', '').replace('<', '')}"
if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
From 45f75fb7a6ddec95f91296129c34744174add5aa Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Fri, 19 Jun 2020 15:33:00 +0530
Subject: [PATCH 015/190] Fix crash if Mega API key is not provided
Signed-off-by: lzzy12
---
bot/__init__.py | 2 +-
bot/helper/mirror_utils/download_utils/mega_downloader.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/bot/__init__.py b/bot/__init__.py
index 76fca77e4..a42a0aebb 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -84,7 +84,7 @@ def getConfig(name: str):
MEGA_API_KEY = getConfig('MEGA_API_KEY')
except KeyError:
logging.warning('MEGA API KEY not provided!')
-
+ MEGA_API_KEY = None
try:
MEGA_EMAIL_ID = getConfig('MEGA_EMAIL_ID')
MEGA_PASSWORD = getConfig('MEGA_PASSWORD')
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 1c8c9874a..081356a0e 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -121,7 +121,8 @@ class MegaDownloadHelper:
def __init__(self):
pass
- def add_download(self, mega_link: str, path: str, listener):
+ @staticmethod
+ def add_download(mega_link: str, path: str, listener):
if MEGA_API_KEY is None:
raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror mega links')
executor = AsyncExecutor()
From 1b79bbda6e4918dbf62b0f94e4206f6e4165c1bc Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sun, 21 Jun 2020 13:39:15 +0530
Subject: [PATCH 016/190] Fix error extraction
---
.../mirror_utils/upload_utils/gdriveTools.py | 57 +++++++------------
1 file changed, 22 insertions(+), 35 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 61e611a73..e91850601 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -290,44 +290,31 @@ def clone(self, link):
LOGGER.info(f"File ID: {file_id}")
try:
meta = self.getFileMetadata(file_id)
- except Exception as e:
- return f"{str(e).replace('>', '').replace('<', '')}"
- if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
- dir_id = self.create_directory(meta.get('name'), parent_id)
- try:
+ if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
+ dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
- except Exception as e:
- if isinstance(e, RetryError):
- LOGGER.info(f"Total Attempts: {e.last_attempt.attempt_number}")
- err = e.last_attempt.exception()
- else:
- err = str(e).replace('>', '').replace('<', '')
- LOGGER.error(err)
- return err
- msg += f'{meta.get("name")}' \
- f' ({get_readable_file_size(self.transferred_size)})'
- if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
- msg += f' | Index URL'
- else:
- try:
- file = self.copyFile(meta.get('id'), parent_id)
- except Exception as e:
- if isinstance(e, RetryError):
- LOGGER.info(f"Total Attempts: {e.last_attempt.attempt_number}")
- err = e.last_attempt.exception()
- else:
- err = str(e).replace('>', '').replace('<', '')
- LOGGER.error(err)
- return err
- msg += f'{file.get("name")}'
- try:
- msg += f' ({get_readable_file_size(int(meta.get("size")))}) '
+ msg += f'{meta.get("name")}' \
+ f' ({get_readable_file_size(self.transferred_size)})'
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
msg += f' | Index URL'
- except TypeError:
- pass
+ else:
+ file = self.copyFile(meta.get('id'), parent_id)
+ msg += f'{file.get("name")}'
+ try:
+ msg += f' ({get_readable_file_size(int(meta.get("size")))}) '
+ except TypeError:
+ pass
+ if INDEX_URL is not None:
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ msg += f' | Index URL'
+ except Exception as err:
+ if isinstance(err, RetryError):
+ LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
+ err = err.last_attempt.exception()
+ err = str(err).replace('>', '').replace('<', '')
+ LOGGER.error(err)
+ return err
return msg
def cloneFolder(self, name, local_path, folder_id, parent_id):
From 53c34db027d5a52af63d9d775dad32a180c94a98 Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sun, 21 Jun 2020 14:02:24 +0530
Subject: [PATCH 017/190] Added cpu and ram usage in stats
---
bot/__main__.py | 9 +++++++--
requirements.txt | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 34df995b5..bc432bb0e 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -1,9 +1,10 @@
-import shutil
+import shutil, psutil
import signal
import pickle
from os import execl, path, remove
from sys import executable
+import time
from telegram.ext import CommandHandler, run_async
from bot import dispatcher, updater, botStartTime
@@ -22,10 +23,14 @@ def stats(update, context):
total = get_readable_file_size(total)
used = get_readable_file_size(used)
free = get_readable_file_size(free)
+ cpuUsage = psutil.cpu_percent(interval=0.5)
+ memory = psutil.virtual_memory().percent
stats = f'Bot Uptime: {currentTime}\n' \
f'Total disk space: {total}\n' \
f'Used: {used}\n' \
- f'Free: {free}'
+ f'Free: {free}\n' \
+ f'CPU: {cpuUsage}%\n' \
+ f'RAM: {memory}%'
sendMessage(stats, context.bot, update)
diff --git a/requirements.txt b/requirements.txt
index 078a15ebb..9a915ff40 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,5 @@
requests
+psutil
python-telegram-bot==12.6.1
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
From 79ff0f7af8905b5c974253904616f6a79fccb06b Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 22 Jun 2020 15:41:09 +0530
Subject: [PATCH 018/190] Added CPU, DISK, RAM usage in /status and /stats both
---
bot/__main__.py | 14 ++++++++------
bot/helper/telegram_helper/message_utils.py | 10 ++++++----
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index bc432bb0e..b02afa626 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -25,12 +25,14 @@ def stats(update, context):
free = get_readable_file_size(free)
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
- stats = f'Bot Uptime: {currentTime}\n' \
- f'Total disk space: {total}\n' \
- f'Used: {used}\n' \
- f'Free: {free}\n' \
- f'CPU: {cpuUsage}%\n' \
- f'RAM: {memory}%'
+ disk = psutil.disk_usage('/').percent
+ stats = f'Bot Uptime: {currentTime}\n' \
+ f'Total disk space: {total}\n' \
+ f'Used: {used} ' \
+ f'Free: {free}\n\n' \
+ f'CPU: {cpuUsage}% ' \
+ f'RAM: {memory}% ' \
+ f'Disk: {disk}%'
sendMessage(stats, context.bot, update)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index c2a503213..d387c7c35 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -65,8 +65,9 @@ def delete_all_messages():
def update_all_messages():
msg = get_readable_message()
- msg += f"CPU: {psutil.cpu_percent()} %" \
- f" DISK: {psutil.disk_usage('/').percent} %"
+ msg += f"CPU: {psutil.cpu_percent()}%" \
+ f" DISK: {psutil.disk_usage('/').percent}%" \
+ f" RAM: {psutil.virtual_memory().percent}%"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -79,8 +80,9 @@ def update_all_messages():
def sendStatusMessage(msg, bot):
progress = get_readable_message()
- progress += f"CPU: {psutil.cpu_percent()} %" \
- f" DISK: {psutil.disk_usage('/').percent} %"
+ progress += f"CPU: {psutil.cpu_percent()}%" \
+ f" DISK: {psutil.disk_usage('/').percent}%" \
+ f" RAM: {psutil.virtual_memory().percent}%"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:
From f5f1c802ae31ea9b57de2e393d9ac51775c4330e Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 22 Jun 2020 16:36:06 +0530
Subject: [PATCH 019/190] Added Inline Buttons
---
.../mirror_utils/upload_utils/gdriveTools.py | 19 ++++++++++++-------
bot/helper/telegram_helper/button_build.py | 16 ++++++++++++++++
bot/helper/telegram_helper/message_utils.py | 6 ++++++
bot/modules/clone.py | 4 ++--
bot/modules/mirror.py | 10 +++++++---
5 files changed, 43 insertions(+), 12 deletions(-)
create mode 100644 bot/helper/telegram_helper/button_build.py
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index e91850601..e5c401abc 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -16,6 +16,8 @@
from googleapiclient.http import MediaFileUpload
from tenacity import *
+from telegram import InlineKeyboardMarkup
+from bot.helper.telegram_helper import button_build
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
USE_SERVICE_ACCOUNTS, download_dict
from bot.helper.ext_utils.bot_utils import *
@@ -293,21 +295,24 @@ def clone(self, link):
if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
- msg += f'{meta.get("name")}' \
- f' ({get_readable_file_size(self.transferred_size)})'
+ msg += f'Filename : {meta.get("name")}\nSize : {get_readable_file_size(self.transferred_size)}'
+ buttons = button_build.ButtonMaker()
+ buttons.buildbutton("⚡Drive Link⚡", self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id))
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
- msg += f' | Index URL'
+ buttons.buildbutton("💥Index Link💥", url)
else:
file = self.copyFile(meta.get('id'), parent_id)
- msg += f'{file.get("name")}'
+ msg += f'Filename : {file.get("name")}'
+ buttons = button_build.ButtonMaker()
+ buttons.buildbutton("⚡Drive Link⚡", self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id")))
try:
- msg += f' ({get_readable_file_size(int(meta.get("size")))}) '
+ msg += f'\nSize : {get_readable_file_size(int(meta.get("size")))}'
except TypeError:
pass
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
- msg += f' | Index URL'
+ buttons.buildbutton("💥Index Link💥", url)
except Exception as err:
if isinstance(err, RetryError):
LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
@@ -315,7 +320,7 @@ def clone(self, link):
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
return err
- return msg
+ return msg, InlineKeyboardMarkup(buttons.build_menu(2))
def cloneFolder(self, name, local_path, folder_id, parent_id):
LOGGER.info(f"Syncing: {local_path}")
diff --git a/bot/helper/telegram_helper/button_build.py b/bot/helper/telegram_helper/button_build.py
new file mode 100644
index 000000000..1b85b520c
--- /dev/null
+++ b/bot/helper/telegram_helper/button_build.py
@@ -0,0 +1,16 @@
+from telegram import InlineKeyboardButton
+
+class ButtonMaker:
+ def __init__(self):
+ self.button = []
+
+ def buildbutton(self, key, link):
+ self.button.append(InlineKeyboardButton(text = key, url = link))
+
+ def build_menu(self, n_cols, footer_buttons=None, header_buttons=None):
+ menu = [self.button[i:i + n_cols] for i in range(0, len(self.button), n_cols)]
+ if header_buttons:
+ menu.insert(0, header_buttons)
+ if footer_buttons:
+ menu.append(footer_buttons)
+ return menu
\ No newline at end of file
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index d387c7c35..8635654a3 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -1,3 +1,4 @@
+from telegram import InlineKeyboardMarkup
from telegram.message import Message
from telegram.update import Update
import time
@@ -18,6 +19,11 @@ def sendMessage(text: str, bot, update: Update):
LOGGER.error(str(e))
+def sendMarkup(text: str, bot, update: Update, reply_markup: InlineKeyboardMarkup):
+ return bot.send_message(update.message.chat_id,
+ reply_to_message_id=update.message.message_id,
+ text=text, reply_markup=reply_markup, parse_mode='HTMl')
+
def editMessage(text: str, message: Message):
try:
bot.edit_message_text(text=text, message_id=message.message_id,
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index 47202ffba..e3ed12d6f 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -14,9 +14,9 @@ def cloneNode(update,context):
link = args[1]
msg = sendMessage(f"Cloning: {link}",context.bot,update)
gd = GoogleDriveHelper()
- result = gd.clone(link)
+ result, button = gd.clone(link)
deleteMessage(context.bot,msg)
- sendMessage(result,context.bot,update)
+ sendMarkup(result,context.bot,update,button)
else:
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 0066cf63d..98d4f7c63 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -1,5 +1,6 @@
import requests
from telegram.ext import CommandHandler, run_async
+from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock
@@ -18,6 +19,7 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.message_utils import *
+from bot.helper.telegram_helper import button_build
import pathlib
import os
@@ -135,13 +137,15 @@ def onUploadProgress(self):
def onUploadComplete(self, link: str):
with download_dict_lock:
- msg = f'{download_dict[self.uid].name()} ({download_dict[self.uid].size()})'
+ msg = f'Filename : {download_dict[self.uid].name()}\nSize : {download_dict[self.uid].size()}'
+ buttons = button_build.ButtonMaker()
+ buttons.buildbutton("⚡Drive Link⚡", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}')
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
- msg += f'\n\n Shareable link: here'
+ buttons.buildbutton("💥Index Link💥", share_url)
if self.message.from_user.username:
uname = f"@{self.message.from_user.username}"
else:
@@ -154,7 +158,7 @@ def onUploadComplete(self, link: str):
pass
del download_dict[self.uid]
count = len(download_dict)
- sendMessage(msg, self.bot, self.update)
+ sendMarkup(msg, self.bot, self.update, InlineKeyboardMarkup(buttons.build_menu(2)))
if count == 0:
self.clean()
else:
From e77290528e1275a5e9fc00f738821785e971cb19 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Sat, 27 Jun 2020 20:18:08 +0530
Subject: [PATCH 020/190] Fixed downloads from torrent files won't show seeders
and peers
Signed-off-by: lzzy12
# Conflicts:
# bot/helper/mirror_utils/download_utils/aria2_download.py
---
bot/helper/mirror_utils/download_utils/aria2_download.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index e30a0a9d9..e85a07b04 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -1,4 +1,4 @@
-from bot import aria2, download_dict_lock
+from bot import aria2
from bot.helper.ext_utils.bot_utils import *
from .download_helper import DownloadHelper
from bot.helper.mirror_utils.status_utils.aria_download_status import AriaDownloadStatus
@@ -24,9 +24,10 @@ def __onDownloadComplete(self, api: API, gid):
download = api.get_download(gid)
if download.followed_by_ids:
new_gid = download.followed_by_ids[0]
+ new_download = api.get_download(new_gid)
with download_dict_lock:
- download_dict[dl.uid()] = AriaDownloadStatus(new_gid,dl.getListener())
- if download.is_torrent:
+ download_dict[dl.uid()] = AriaDownloadStatus(new_gid, dl.getListener())
+ if new_download.is_torrent:
download_dict[dl.uid()].is_torrent = True
update_all_messages()
LOGGER.info(f'Changed gid from {gid} to {new_gid}')
From b5a162f15d1715faa5529fa998cfcdb29f0cccbc Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Sat, 27 Jun 2020 23:40:15 +0530
Subject: [PATCH 021/190] Use subprocess.run to call extract shell script
Signed-off-by: lzzy12
---
bot/helper/ext_utils/bot_utils.py | 2 ++
bot/helper/ext_utils/exceptions.py | 6 +++++
bot/helper/ext_utils/fs_utils.py | 21 +++++++++--------
bot/modules/mirror.py | 37 +++++++++++++++---------------
extract | 6 +++--
5 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index a015fb79f..15a7feb12 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -137,9 +137,11 @@ def is_magnet(url: str):
return True
return False
+
def is_mega_link(url: str):
return "mega.nz" in url
+
def new_thread(fn):
"""To use as decorator to make a function call threaded.
Needs import
diff --git a/bot/helper/ext_utils/exceptions.py b/bot/helper/ext_utils/exceptions.py
index 25ff87fa6..a2f600c27 100644
--- a/bot/helper/ext_utils/exceptions.py
+++ b/bot/helper/ext_utils/exceptions.py
@@ -1,2 +1,8 @@
class DirectDownloadLinkException(Exception):
+ """Not method found for extracting direct download link from the http link"""
+ pass
+
+
+class NotSupportedExtractionArchive(Exception):
+ """The archive format use is trying to extract is not supported"""
pass
diff --git a/bot/helper/ext_utils/fs_utils.py b/bot/helper/ext_utils/fs_utils.py
index 90951d60a..8044c76ac 100644
--- a/bot/helper/ext_utils/fs_utils.py
+++ b/bot/helper/ext_utils/fs_utils.py
@@ -5,6 +5,7 @@
import pathlib
import magic
import tarfile
+from .exceptions import NotSupportedExtractionArchive
def clean_download(path: str):
@@ -60,25 +61,25 @@ def get_base_name(orig_path: str):
if orig_path.endswith(".tar.bz2"):
return orig_path.replace(".tar.bz2", "")
elif orig_path.endswith(".tar.gz"):
- return orig_path.replace(".tar.gz","")
+ return orig_path.replace(".tar.gz", "")
elif orig_path.endswith(".bz2"):
- return orig_path.replace(".bz2","")
+ return orig_path.replace(".bz2", "")
elif orig_path.endswith(".gz"):
- return orig_path.replace(".gz","")
+ return orig_path.replace(".gz", "")
elif orig_path.endswith(".tar"):
- return orig_path.replace(".tar","")
+ return orig_path.replace(".tar", "")
elif orig_path.endswith(".tbz2"):
- return orig_path.replace("tbz2","")
+ return orig_path.replace("tbz2", "")
elif orig_path.endswith(".tgz"):
- return orig_path.replace(".tgz","")
+ return orig_path.replace(".tgz", "")
elif orig_path.endswith(".zip"):
- return orig_path.replace(".zip","")
+ return orig_path.replace(".zip", "")
elif orig_path.endswith(".Z"):
- return orig_path.replace(".Z","")
+ return orig_path.replace(".Z", "")
elif orig_path.endswith(".rar"):
- return orig_path.replace(".rar","")
+ return orig_path.replace(".rar", "")
else:
- return "unsupported"
+ raise NotSupportedExtractionArchive('File format not supported for extraction')
def get_mime_type(file_path):
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index dc1c3fa8a..e86d0b316 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -5,7 +5,7 @@
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
-from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
+from bot.helper.ext_utils.exceptions import DirectDownloadLinkException, NotSupportedExtractionArchive
from bot.helper.mirror_utils.download_utils.aria2_download import AriaDownloadHelper
from bot.helper.mirror_utils.download_utils.mega_downloader import MegaDownloadHelper
from bot.helper.mirror_utils.download_utils.direct_link_generator import direct_link_generator
@@ -20,6 +20,8 @@
from bot.helper.telegram_helper.message_utils import *
import pathlib
import os
+import subprocess
+import threading
ariaDlManager = AriaDownloadHelper()
ariaDlManager.start_listener()
@@ -66,30 +68,29 @@ def onDownloadComplete(self):
return
elif self.extract:
download.is_extracting = True
-
- path = fs_utils.get_base_name(m_path)
- if path != "unsupported":
+ try:
+ path = fs_utils.get_base_name(m_path)
LOGGER.info(
- f"Extracting : {download_dict[self.uid].name()} "
+ f"Extracting : {name} "
)
- download_dict[self.uid] = ExtractStatus(name, m_path, size)
- os.system(f"extract '{m_path}'")
- if not os.path.exists(path):
- self.onUploadError("Cannot extract file, check integrity of the file")
- return
+ with download_dict_lock:
+ download_dict[self.uid] = ExtractStatus(name, m_path, size)
+ archive_result = subprocess.run(["extract", m_path])
+ if archive_result.returncode == 0:
+ threading.Thread(target=os.remove, args=(m_path,)).start()
+ LOGGER.info(f"Deleting archive : {m_path}")
+ else:
+ LOGGER.warning('Unable to extract archive! Uploading anyway')
+ path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
LOGGER.info(
f'got path : {path}'
)
- try:
- os.remove(m_path)
- LOGGER.info(f"Deleting archive : {m_path}")
- except Exception as e:
- LOGGER.error(str(e))
- else:
+
+ except NotSupportedExtractionArchive:
LOGGER.info("Not any valid archive, uploading file as it is.")
- path = f'{DOWNLOAD_DIR}{self.uid}/{download_dict[self.uid].name()}'
+ path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
else:
- path = f'{DOWNLOAD_DIR}{self.uid}/{download_dict[self.uid].name()}'
+ path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
up_name = pathlib.PurePath(path).name
LOGGER.info(f"Upload Name : {up_name}")
drive = gdriveTools.GoogleDriveHelper(up_name, self)
diff --git a/extract b/extract
index f124d7c9b..2a5aa6c4c 100755
--- a/extract
+++ b/extract
@@ -25,8 +25,10 @@ extract () {
*.rar)
a_dir=`expr "$arg" : '\(.*\).rar'` ;
mkdir "$a_dir" ;
- 7z x "$arg" -o"$a_dir" ;;
- *) echo "'$arg' cannot be extracted via extract()" ;;
+ 7z x "$arg" -o"$a_dir" ;;
+ *) echo "'$arg' cannot be extracted via extract()" 1>&2
+ exit 1 ;;
+
esac
cd - || exit
}
From fed3be2411e98d8d59060b0e3ec249488cb5a6cc Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Sun, 28 Jun 2020 14:26:41 +0530
Subject: [PATCH 022/190] Return correct exit codes from extract script
Signed-off-by: lzzy12
---
extract | 84 ++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 56 insertions(+), 28 deletions(-)
diff --git a/extract b/extract
index 2a5aa6c4c..8e47862f9 100755
--- a/extract
+++ b/extract
@@ -1,36 +1,64 @@
#!/bin/bash
-if [ $# -lt 1 ];then
- echo "Usage: `basename $0` FILES"
+if [ $# -lt 1 ]; then
+ echo "Usage: $(basename $0) FILES"
exit 1
fi
-extract () {
- arg="$1"
- cd "$(dirname "$arg")" || exit
- case "$arg" in
- *.tar.bz2)
- tar xjf "$arg" --one-top-level ;;
- *.tar.gz)
- tar xzf "$arg" --one-top-level ;;
- *.bz2) bunzip2 "$arg" ;;
- *.gz) gunzip "$arg" ;;
- *.tar) tar xf "$arg" --one-top-level ;;
- *.tbz2) tar xjf "$arg" --one-top-level ;;
- *.tgz) tar xzf "$arg" --one-top-level ;;
- *.zip)
- a_dir=`expr "$arg" : '\(.*\).zip'`
- 7z x "$arg" -o"$a_dir" ;;
- *.Z) uncompress "$arg" ;;
- *.rar)
- a_dir=`expr "$arg" : '\(.*\).rar'` ;
- mkdir "$a_dir" ;
- 7z x "$arg" -o"$a_dir" ;;
- *) echo "'$arg' cannot be extracted via extract()" 1>&2
- exit 1 ;;
-
- esac
- cd - || exit
+extract() {
+ arg="$1"
+ cd "$(dirname "$arg")" || exit
+ case "$arg" in
+ *.tar.bz2)
+ tar xjf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.tar.gz)
+ tar xzf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.bz2)
+ bunzip2 "$arg"
+ local code=$?
+ ;;
+ *.gz)
+ gunzip "$arg"
+ local code=$?
+ ;;
+ *.tar)
+ tar xf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.tbz2)
+ (tar xjf "$arg" --one-top-level)
+ local code=$?
+ ;;
+ *.tgz)
+ tar xzf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.zip)
+ a_dir=$(expr "$arg" : '\(.*\).zip')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.Z)
+ uncompress "$arg"
+ local code=$?
+ ;;
+ *.rar)
+ a_dir=$(expr "$arg" : '\(.*\).rar')
+ mkdir "$a_dir"
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *)
+ echo "'$arg' cannot be extracted via extract()" 1>&2
+ exit 1
+ ;;
+ esac
+ cd - || exit $?
+ exit $code
}
extract "$1"
From 1aed50a5f40b6f5acf44fff02d4dca76e168f612 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Sun, 28 Jun 2020 14:51:55 +0530
Subject: [PATCH 023/190] Fixed multiple /unzipmirror commands gets all the
mirrors stuck
Signed-off-by: lzzy12
---
bot/helper/ext_utils/bot_utils.py | 6 +++++-
bot/helper/mirror_utils/status_utils/extract_status.py | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 15a7feb12..35452f259 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -62,7 +62,9 @@ def get_readable_file_size(size_in_bytes) -> str:
def getDownloadByGid(gid):
with download_dict_lock:
for dl in download_dict.values():
- if dl.status() != MirrorStatus.STATUS_UPLOADING and dl.status() != MirrorStatus.STATUS_ARCHIVING:
+ status = dl.status()
+ if status != MirrorStatus.STATUS_UPLOADING and status != MirrorStatus.STATUS_ARCHIVING\
+ and status != MirrorStatus.STATUS_EXTRACTING:
if dl.gid() == gid:
return dl
return None
@@ -146,8 +148,10 @@ def new_thread(fn):
"""To use as decorator to make a function call threaded.
Needs import
from threading import Thread"""
+
def wrapper(*args, **kwargs):
thread = threading.Thread(target=fn, args=args, kwargs=kwargs)
thread.start()
return thread
+
return wrapper
diff --git a/bot/helper/mirror_utils/status_utils/extract_status.py b/bot/helper/mirror_utils/status_utils/extract_status.py
index f7f5e59d6..41b6ff591 100644
--- a/bot/helper/mirror_utils/status_utils/extract_status.py
+++ b/bot/helper/mirror_utils/status_utils/extract_status.py
@@ -8,7 +8,7 @@ def __init__(self, name, path, size):
self.__path = path
self.__size = size
- # The progress of Tar function cannot be tracked. So we just return dummy values.
+ # The progress of extract function cannot be tracked. So we just return dummy values.
# If this is possible in future,we should implement it
def progress(self):
From fb75f71325f8c9c27ba815f3436f7ec158db5ce3 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Tue, 30 Jun 2020 16:23:27 +0530
Subject: [PATCH 024/190] Added delete command for drive files
---
bot/__main__.py | 2 +-
.../mirror_utils/upload_utils/gdriveTools.py | 19 ++++++++++++
bot/helper/telegram_helper/bot_commands.py | 1 +
bot/modules/delete.py | 30 +++++++++++++++++++
4 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 bot/modules/delete.py
diff --git a/bot/__main__.py b/bot/__main__.py
index b02afa626..e8803119c 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -13,7 +13,7 @@
from bot.helper.telegram_helper.message_utils import *
from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time
from .helper.telegram_helper.filters import CustomFilters
-from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch
+from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete
@run_async
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index e5c401abc..c5b52c7cc 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -182,6 +182,25 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
download_url = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(drive_file.get('id'))
return download_url
+ def deletefile(self, link: str):
+ try:
+ file_id = self.getIdFromUrl(link)
+ except (KeyError,IndexError):
+ msg = "Google drive ID could not be found in the provided link"
+ return msg
+ msg = ''
+ try:
+ res = self.__service.files().delete(fileId=file_id, supportsTeamDrives=IS_TEAM_DRIVE).execute()
+ msg = "Successfully deleted"
+ except HttpError as err:
+ LOGGER.error(str(err))
+ if "File not found" in str(err):
+ msg = "No such file exist"
+ else:
+ msg = "Something went wrong check log"
+ finally:
+ return msg
+
def upload(self, file_name: str):
if USE_SERVICE_ACCOUNTS:
self.service_account_count = len(os.listdir("accounts"))
diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py
index bd1af0c25..c0d2cf401 100644
--- a/bot/helper/telegram_helper/bot_commands.py
+++ b/bot/helper/telegram_helper/bot_commands.py
@@ -18,5 +18,6 @@ def __init__(self):
self.CloneCommand = "clone"
self.WatchCommand = 'watch'
self.TarWatchCommand = 'tarwatch'
+ self.deleteCommand = 'del'
BotCommands = _BotCommands()
diff --git a/bot/modules/delete.py b/bot/modules/delete.py
new file mode 100644
index 000000000..783d9fc2c
--- /dev/null
+++ b/bot/modules/delete.py
@@ -0,0 +1,30 @@
+from telegram.ext import CommandHandler, run_async
+import threading
+from telegram import Update
+from bot import dispatcher, LOGGER
+from bot.helper.telegram_helper.message_utils import auto_delete_message, sendMessage
+from bot.helper.telegram_helper.filters import CustomFilters
+from bot.helper.telegram_helper.bot_commands import BotCommands
+from bot.helper.mirror_utils.upload_utils import gdriveTools
+
+@run_async
+def deletefile(update, context):
+ msg_args = update.message.text.split(None, 1)
+ msg = ''
+ try:
+ link = msg_args[1]
+ LOGGER.info(msg_args[1])
+ except IndexError:
+ msg = 'send a link along with command'
+
+ if msg == '' :
+ drive = gdriveTools.GoogleDriveHelper()
+ msg = drive.deletefile(link)
+ LOGGER.info(f"this is msg : {msg}")
+ reply_message = sendMessage(msg, context.bot, update)
+
+ threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
+
+delete_handler = CommandHandler(command=BotCommands.deleteCommand, callback=deletefile,
+ filters=CustomFilters.owner_filter)
+dispatcher.add_handler(delete_handler)
\ No newline at end of file
From f0eed930a55ad376d24a1f90ec6480906bde04ae Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Wed, 1 Jul 2020 12:19:20 +0530
Subject: [PATCH 025/190] Fixed : bot doesn't send clone error
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 5 +++--
bot/helper/telegram_helper/message_utils.py | 10 +++++++---
bot/modules/clone.py | 5 ++++-
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index c5b52c7cc..4f349b44d 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -18,6 +18,7 @@
from telegram import InlineKeyboardMarkup
from bot.helper.telegram_helper import button_build
+
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
USE_SERVICE_ACCOUNTS, download_dict
from bot.helper.ext_utils.bot_utils import *
@@ -306,7 +307,7 @@ def clone(self, link):
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
msg = "Google drive ID could not be found in the provided link"
- return msg
+ return msg, ""
msg = ""
LOGGER.info(f"File ID: {file_id}")
try:
@@ -338,7 +339,7 @@ def clone(self, link):
err = err.last_attempt.exception()
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
- return err
+ return err, ""
return msg, InlineKeyboardMarkup(buttons.build_menu(2))
def cloneFolder(self, name, local_path, folder_id, parent_id):
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 8635654a3..568c012c4 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -20,9 +20,13 @@ def sendMessage(text: str, bot, update: Update):
def sendMarkup(text: str, bot, update: Update, reply_markup: InlineKeyboardMarkup):
- return bot.send_message(update.message.chat_id,
- reply_to_message_id=update.message.message_id,
- text=text, reply_markup=reply_markup, parse_mode='HTMl')
+ try:
+ return bot.send_message(update.message.chat_id,
+ reply_to_message_id=update.message.message_id,
+ text=text, reply_markup=reply_markup, parse_mode='HTMl')
+ except Exception as e:
+ LOGGER.error(str(e))
+
def editMessage(text: str, message: Message):
try:
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index e3ed12d6f..32cf998c7 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -16,7 +16,10 @@ def cloneNode(update,context):
gd = GoogleDriveHelper()
result, button = gd.clone(link)
deleteMessage(context.bot,msg)
- sendMarkup(result,context.bot,update,button)
+ if button == "":
+ sendMessage(result,context.bot,update)
+ else:
+ sendMarkup(result,context.bot,update,button)
else:
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
From aa8428fdfae2cee3557b3351a67b49e242372a61 Mon Sep 17 00:00:00 2001
From: lzzy12
Date: Wed, 1 Jul 2020 12:43:33 +0530
Subject: [PATCH 026/190] Dockerfile: Install rar codecs for 7z
Signed-off-by: lzzy12
---
Dockerfile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 8cc39e3b9..4d8526461 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,8 +3,13 @@ FROM lzzy12/mega-sdk-python:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
-RUN apt-get -qq update
-RUN apt-get -qq install -y p7zip-full aria2 curl pv jq ffmpeg locales python3-lxml
+RUN apt-get -qq update && \
+ apt-get install -y software-properties-common && \
+ rm -rf /var/lib/apt/lists/* && \
+ apt-add-repository non-free && \
+ apt-get -qq update && \
+ apt-get -qq install -y p7zip-full p7zip-rar aria2 curl pv jq ffmpeg locales python3-lxml && \
+ apt-get purge -y software-properties-common
COPY requirements.txt .
COPY extract /usr/local/bin
From d5dde4b6a7e5f5bdf1895a787610b762b324ce2a Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sat, 4 Jul 2020 15:02:49 +0530
Subject: [PATCH 027/190] Update /stats msg
---
bot/__main__.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bot/__main__.py b/bot/__main__.py
index e8803119c..c70453675 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -23,6 +23,8 @@ def stats(update, context):
total = get_readable_file_size(total)
used = get_readable_file_size(used)
free = get_readable_file_size(free)
+ sent = get_readable_file_size(psutil.net_io_counters().bytes_sent)
+ recv = get_readable_file_size(psutil.net_io_counters().bytes_recv)
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
@@ -30,6 +32,8 @@ def stats(update, context):
f'Total disk space: {total}\n' \
f'Used: {used} ' \
f'Free: {free}\n\n' \
+ f'📊Data Usage📊\nUpload: {sent}\n' \
+ f'Down: {recv}\n\n' \
f'CPU: {cpuUsage}% ' \
f'RAM: {memory}% ' \
f'Disk: {disk}%'
From 7dbda06cb4be2c8830e13034be1444f0a4cd09b6 Mon Sep 17 00:00:00 2001
From: SVR666
Date: Wed, 22 Jul 2020 14:45:20 +0530
Subject: [PATCH 028/190] Modified : List command | now results will be
uploaded to telegra.ph
---
README.md | 10 +++-
bot/__init__.py | 1 +
.../mirror_utils/upload_utils/gdriveTools.py | 57 +++++++++++++------
bot/modules/list.py | 25 ++++----
config_sample.env | 1 +
generate_telegraph_token.py | 6 ++
requirements.txt | 3 +-
7 files changed, 69 insertions(+), 34 deletions(-)
create mode 100644 generate_telegraph_token.py
diff --git a/README.md b/README.md
index e0caedadb..8dc6a6a60 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,10 @@ _____REMOVE_THIS_LINE_____=True
Fill up rest of the fields. Meaning of each fields are discussed below:
- **BOT_TOKEN** : The telegram bot token that you get from @BotFather
- **GDRIVE_FOLDER_ID** : This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
+- **TELEGRAPH_TOKEN** : Telegraph token generated by runnning :
+```
+python3 generate_telegraph_token.py
+```
- **DOWNLOAD_DIR** : The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD_STATUS_UPDATE_INTERVAL** : A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it 5 seconds at least)
- **OWNER_ID** : The Telegram user ID (not username) of the owner of the bot
@@ -79,12 +83,12 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
- **USER_SESSION_STRING** : Session string generated by running:
-- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
-- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
-- **MEGA_PASSWORD**: Your password for your mega.nz account
```
python3 generate_string_session.py
```
+- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
+- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
+- **MEGA_PASSWORD**: Your password for your mega.nz account
Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 2
## Getting Google OAuth API credential file
diff --git a/bot/__init__.py b/bot/__init__.py
index a42a0aebb..974f9b395 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -67,6 +67,7 @@ def getConfig(name: str):
try:
BOT_TOKEN = getConfig('BOT_TOKEN')
parent_id = getConfig('GDRIVE_FOLDER_ID')
+ telegraph_token = getConfig('TELEGRAPH_TOKEN')
DOWNLOAD_DIR = getConfig('DOWNLOAD_DIR')
if DOWNLOAD_DIR[-1] != '/' or DOWNLOAD_DIR[-1] != '\\':
DOWNLOAD_DIR = DOWNLOAD_DIR + '/'
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 4f349b44d..a6bd8320c 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -18,9 +18,10 @@
from telegram import InlineKeyboardMarkup
from bot.helper.telegram_helper import button_build
+from telegraph import Telegraph
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
- USE_SERVICE_ACCOUNTS, download_dict
+ USE_SERVICE_ACCOUNTS, download_dict, telegraph_token
from bot.helper.ext_utils.bot_utils import *
from bot.helper.ext_utils.fs_utils import get_mime_type
@@ -440,22 +441,42 @@ def drive_list(self, fileName):
includeTeamDriveItems=True,
q=query,
spaces='drive',
- pageSize=20,
+ pageSize=200,
fields='files(id, name, mimeType, size)',
orderBy='modifiedTime desc').execute()
- for file in response.get('files', []):
- if file.get(
- 'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
- msg += f"⁍ {file.get('name')}" \
- f" (folder)"
- if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
- msg += f' | Index URL'
- else:
- msg += f"⁍ {file.get('name')} ({get_readable_file_size(int(file.get('size')))})"
- if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
- msg += f' | Index URL'
- msg += '\n'
- return msg
+
+ if response["files"]:
+ msg += f'Results : {fileName}
'
+
+ for file in response.get('files', []):
+ if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
+ msg += f"⁍{file.get('name')}
(folder📁)
" \
+ f"Drive Link"
+ if INDEX_URL is not None:
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
+ msg += f' | Index Link'
+
+ else:
+ msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
" \
+ f"Drive Link"
+ if INDEX_URL is not None:
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ msg += f' | Index Link'
+
+ msg += '
'
+
+ response = Telegraph(access_token=telegraph_token).create_page(
+ title = 'Mirror Bot Search',
+ author_name='Mirror Bot',
+ author_url='https://github.com/magneto261290/magneto-python-aria',
+ html_content=msg
+ )['path']
+
+ msg = f"Search Results For {fileName} 👇"
+ buttons = button_build.ButtonMaker()
+ buttons.buildbutton("HERE", f"https://telegra.ph/{response}")
+
+ return msg, InlineKeyboardMarkup(buttons.build_menu(1))
+
+ else :
+ return '', ''
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 24a641c0a..40a2fff0f 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -1,24 +1,25 @@
from telegram.ext import CommandHandler, run_async
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot import LOGGER, dispatcher
-from bot.helper.telegram_helper.message_utils import auto_delete_message, sendMessage
+from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup
from bot.helper.telegram_helper.filters import CustomFilters
-import threading
from bot.helper.telegram_helper.bot_commands import BotCommands
@run_async
def list_drive(update,context):
- message = update.message.text
- search = message.split(' ',maxsplit=1)[1]
- LOGGER.info(f"Searching: {search}")
- gdrive = GoogleDriveHelper(None)
- msg = gdrive.drive_list(search)
- if msg:
- reply_message = sendMessage(msg, context.bot, update)
- else:
- reply_message = sendMessage('No result found', context.bot, update)
+ try:
+ search = update.message.text.split(' ',maxsplit=1)[1]
+ LOGGER.info(f"Searching: {search}")
+ gdrive = GoogleDriveHelper(None)
+ msg, button = gdrive.drive_list(search)
- threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
+ if button:
+ sendMarkup(msg,context.bot,update,button)
+ else:
+ sendMessage('No result found', context.bot, update)
+
+ except IndexError:
+ sendMessage('send a search key along with command', context.bot, update)
list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
diff --git a/config_sample.env b/config_sample.env
index 67ff99cd0..6a532db00 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -4,6 +4,7 @@ _____REMOVE_THIS_LINE_____=True
# ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
BOT_TOKEN = ""
GDRIVE_FOLDER_ID = ""
+TELEGRAPH_TOKEN = ""
OWNER_ID =
DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
diff --git a/generate_telegraph_token.py b/generate_telegraph_token.py
new file mode 100644
index 000000000..ad44e3e40
--- /dev/null
+++ b/generate_telegraph_token.py
@@ -0,0 +1,6 @@
+from telegraph import Telegraph
+
+telegraph = Telegraph()
+telegraph.create_account(short_name=input("Enter a username for your Telegra.ph : "))
+
+print(f"Your Telegra.ph token ==> {telegraph.get_access_token()}")
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 22d66bab1..2b7284c8d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,4 +12,5 @@ beautifulsoup4>=4.8.2,<4.8.10
Pyrogram>=0.16.0,<0.16.10
TgCrypto>=1.1.1,<1.1.10
git+git://github.com/lzzy12/youtube-dl@d7c2b43#youtube_dl
-lxml
\ No newline at end of file
+lxml
+telegraph
\ No newline at end of file
From 1634e65bbf43e7d5ad333c30e04d25c6f59f14f0 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Wed, 22 Jul 2020 15:05:29 +0530
Subject: [PATCH 029/190] Proper Credits
---
README.md | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 8dc6a6a60..3e572224d 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,27 @@
+# Important - Read these points first
+- Original repo is https://github.com/lzzy12/python-aria-mirror-bot
+- I have collected some cool features from various repositories and merged them in one.
+- So, credits goes to original repo holder, not to me. I have just collected them.
+- This (or any custom) repo is not supported in official bot support group.
+- So if you have any issue then check first that issue is in official repo or not, You are only allowed to report that issue in bot support group if that issue is also present in official repo.
+
+## Credits :-
+- First of all, full credit goes to [Shivam Jha aka lzzy12](https://github.com/lzzy12) He build up this bot from scratch.
+- Then a huge thanks to [Sreeraj V R](https://github.com/SVR666) You can checkout his [repo here](https://github.com/SVR666/LoaderX-Bot)
+- Features added from [Sreeraj V R's](https://github.com/SVR666) repo -
+```
+1. Added Inline Buttons
+2. Added /del command to delete files from drive
+3. /list module will post search result on telegra.ph
+```
+- Special thanks to [archie](https://github.com/archie9211) for very much useful feature **Unzipmirror**
+- Features added from [archie's](https://github.com/archie9211) repo
+```
+1. unzipmirror
+2. Update tracker list dynamically
+3. Fix SSL handsake error
+```
+
# What is this repo about?
This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive.
@@ -10,7 +34,7 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Mirror Telegram files to google drive
- Mirror all youtube-dl supported links
- Extract zip, rar, tar and many supported file types and uploads to google drive
-- Copy files from someone's drive to your drive (using Rclone)
+- Copy files from someone's drive to your drive (using Autorclone)
- Service account support in cloning and uploading
- Download progress
- Upload progress
@@ -19,7 +43,7 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Uploading To Team Drives.
- Index Link support
-# Bot commands to be set in botfather
+## Bot commands to be set in botfather
```
mirror - Start Mirroring
@@ -30,6 +54,7 @@ watch - mirror YT-DL support link
tarwatch - mirror youtube playlist link as tar
cancel - Cancel a task
cancelall - Cancel all tasks
+del - Delete file from Drive
list - [query] searches files in G-Drive
status - Get Mirror Status message
stats - Bot Usage Stats
@@ -69,7 +94,7 @@ _____REMOVE_THIS_LINE_____=True
Fill up rest of the fields. Meaning of each fields are discussed below:
- **BOT_TOKEN** : The telegram bot token that you get from @BotFather
- **GDRIVE_FOLDER_ID** : This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
-- **TELEGRAPH_TOKEN** : Telegraph token generated by runnning :
+- **TELEGRAPH_TOKEN** : Telegraph token generated by running :
```
python3 generate_telegraph_token.py
```
From 5d7a60b58c9fc1a22db20410c52624be8062a0ff Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Wed, 22 Jul 2020 23:45:28 +0530
Subject: [PATCH 030/190] Added extra inline buttons (optional) (see
config_sample.env)
---
bot/__init__.py | 24 +++++++++++++++++++
.../mirror_utils/upload_utils/gdriveTools.py | 14 ++++++++++-
bot/modules/mirror.py | 8 ++++++-
config_sample.env | 10 +++++++-
4 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/bot/__init__.py b/bot/__init__.py
index 974f9b395..d7f4b8eb1 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -101,6 +101,30 @@ def getConfig(name: str):
INDEX_URL = None
except KeyError:
INDEX_URL = None
+try:
+ BUTTON_THREE_NAME = getConfig('BUTTON_THREE_NAME')
+ BUTTON_THREE_URL = getConfig('BUTTON_THREE_URL')
+ if len(BUTTON_THREE_NAME) == 0 or len(BUTTON_THREE_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_THREE_NAME = None
+ BUTTON_THREE_URL = None
+try:
+ BUTTON_FOUR_NAME = getConfig('BUTTON_FOUR_NAME')
+ BUTTON_FOUR_URL = getConfig('BUTTON_FOUR_URL')
+ if len(BUTTON_FOUR_NAME) == 0 or len(BUTTON_FOUR_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_FOUR_NAME = None
+ BUTTON_FOUR_URL = None
+try:
+ BUTTON_FIVE_NAME = getConfig('BUTTON_FIVE_NAME')
+ BUTTON_FIVE_URL = getConfig('BUTTON_FIVE_URL')
+ if len(BUTTON_FIVE_NAME) == 0 or len(BUTTON_FIVE_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_FIVE_NAME = None
+ BUTTON_FIVE_URL = None
try:
IS_TEAM_DRIVE = getConfig('IS_TEAM_DRIVE')
if IS_TEAM_DRIVE.lower() == 'true':
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index a6bd8320c..ef4a84e55 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -21,7 +21,7 @@
from telegraph import Telegraph
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
- USE_SERVICE_ACCOUNTS, download_dict, telegraph_token
+ USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL
from bot.helper.ext_utils.bot_utils import *
from bot.helper.ext_utils.fs_utils import get_mime_type
@@ -322,6 +322,12 @@ def clone(self, link):
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
buttons.buildbutton("💥Index Link💥", url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
else:
file = self.copyFile(meta.get('id'), parent_id)
msg += f'Filename : {file.get("name")}'
@@ -334,6 +340,12 @@ def clone(self, link):
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
buttons.buildbutton("💥Index Link💥", url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
except Exception as err:
if isinstance(err, RetryError):
LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 3e7e7d5fc..16e950e44 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -2,7 +2,7 @@
from telegram.ext import CommandHandler, run_async
from telegram import InlineKeyboardMarkup
-from bot import Interval, INDEX_URL
+from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
@@ -147,6 +147,12 @@ def onUploadComplete(self, link: str):
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
buttons.buildbutton("💥Index Link💥", share_url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
if self.message.from_user.username:
uname = f"@{self.message.from_user.username}"
else:
diff --git a/config_sample.env b/config_sample.env
index 6a532db00..5791a14da 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -17,4 +17,12 @@ TELEGRAM_HASH = ""
USE_SERVICE_ACCOUNTS = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
-MEGA_PASSWORD = ""
\ No newline at end of file
+MEGA_PASSWORD = ""
+# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
+# If you don't know what are below entries, simply leave them, Don't fill anything in them.
+BUTTON_THREE_NAME = ""
+BUTTON_THREE_URL = ""
+BUTTON_FOUR_NAME = ""
+BUTTON_FOUR_URL = ""
+BUTTON_FIVE_NAME = ""
+BUTTON_FIVE_URL = ""
\ No newline at end of file
From 020d63bfcd86ecb2ced3e345b31b5be7d8d848d6 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Wed, 29 Jul 2020 20:52:39 +0530
Subject: [PATCH 031/190] added ability of extracting .7z files (#144)
---
bot/helper/ext_utils/fs_utils.py | 2 ++
extract | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/bot/helper/ext_utils/fs_utils.py b/bot/helper/ext_utils/fs_utils.py
index 8044c76ac..cbf50b20e 100644
--- a/bot/helper/ext_utils/fs_utils.py
+++ b/bot/helper/ext_utils/fs_utils.py
@@ -74,6 +74,8 @@ def get_base_name(orig_path: str):
return orig_path.replace(".tgz", "")
elif orig_path.endswith(".zip"):
return orig_path.replace(".zip", "")
+ elif orig_path.endswith(".7z"):
+ return orig_path.replace(".7z", "")
elif orig_path.endswith(".Z"):
return orig_path.replace(".Z", "")
elif orig_path.endswith(".rar"):
diff --git a/extract b/extract
index 8e47862f9..ed175f307 100755
--- a/extract
+++ b/extract
@@ -42,6 +42,11 @@ extract() {
7z x "$arg" -o"$a_dir"
local code=$?
;;
+ *.7z)
+ a_dir=$(expr "$arg" : '\(.*\).7z')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
*.Z)
uncompress "$arg"
local code=$?
From ef6c89059641ba8d278e03dbe600eff917361c82 Mon Sep 17 00:00:00 2001
From: Shubham dubey
Date: Wed, 29 Jul 2020 20:53:34 +0530
Subject: [PATCH 032/190] Fix /list if fileName string contains multiple quotes
(#141)
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index ef4a84e55..8e4ff7f6d 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -445,8 +445,15 @@ def authorize(self):
scopes=self.__OAUTH_SCOPE)
return build('drive', 'v3', credentials=credentials, cache_discovery=False)
+ def escapes(self, str):
+ chars = ['\\', "'", '"', r'\a', r'\b', r'\f', r'\n', r'\r', r'\t']
+ for char in chars:
+ str = str.replace(char, '\\'+char)
+ return str
+
def drive_list(self, fileName):
msg = ""
+ fileName = self.escapes(str(fileName))
# Create Search Query for API request.
query = f"'{parent_id}' in parents and (name contains '{fileName}')"
response = self.__service.files().list(supportsTeamDrives=True,
From ee8bb8da9ce35e8dcccc2c1975d3c4f01d7195aa Mon Sep 17 00:00:00 2001
From: SVR666
Date: Fri, 31 Jul 2020 01:54:07 +0530
Subject: [PATCH 033/190] Fixes and improvements in /list module
---
.../mirror_utils/upload_utils/gdriveTools.py | 57 ++++++++++++++++---
bot/helper/telegram_helper/message_utils.py | 4 +-
bot/modules/list.py | 7 ++-
3 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 8e4ff7f6d..d1c30acc2 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -28,6 +28,7 @@
LOGGER = logging.getLogger(__name__)
logging.getLogger('googleapiclient.discovery').setLevel(logging.ERROR)
SERVICE_ACCOUNT_INDEX = 0
+TELEGRAPHLIMIT = 95
class GoogleDriveHelper:
@@ -55,6 +56,8 @@ def __init__(self, name=None, listener=None):
self.updater = None
self.name = name
self.update_interval = 3
+ self.telegraph_content = []
+ self.path = []
def cancel(self):
self.is_cancelled = True
@@ -445,6 +448,27 @@ def authorize(self):
scopes=self.__OAUTH_SCOPE)
return build('drive', 'v3', credentials=credentials, cache_discovery=False)
+ def edit_telegraph(self):
+ nxt_page = 1
+ prev_page = 0
+ for content in self.telegraph_content :
+ if nxt_page == 1 :
+ content += f'Next'
+ nxt_page += 1
+ else :
+ if prev_page <= self.num_of_path:
+ content += f'Prev'
+ prev_page += 1
+ if nxt_page < self.num_of_path:
+ content += f' | Next'
+ nxt_page += 1
+ Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page],
+ title = 'Mirror Bot Search',
+ author_name='Mirror Bot',
+ author_url='https://github.com/magneto261290/magneto-python-ariap',
+ html_content=content)
+ return
+
def escapes(self, str):
chars = ['\\', "'", '"', r'\a', r'\b', r'\f', r'\n', r'\r', r'\t']
for char in chars:
@@ -464,6 +488,7 @@ def drive_list(self, fileName):
fields='files(id, name, mimeType, size)',
orderBy='modifiedTime desc').execute()
+ content_count = 0
if response["files"]:
msg += f'Results : {fileName}
'
@@ -483,17 +508,33 @@ def drive_list(self, fileName):
msg += f' | Index Link'
msg += '
'
-
- response = Telegraph(access_token=telegraph_token).create_page(
- title = 'Mirror Bot Search',
- author_name='Mirror Bot',
- author_url='https://github.com/magneto261290/magneto-python-aria',
- html_content=msg
- )['path']
+ content_count += 1
+ if content_count == TELEGRAPHLIMIT :
+ self.telegraph_content.append(msg)
+ msg = ""
+ content_count = 0
+
+ if msg != '':
+ self.telegraph_content.append(msg)
+
+ if len(self.telegraph_content) == 0:
+ return "No Result Found :(", None
+
+ for content in self.telegraph_content :
+ self.path.append(Telegraph(access_token=telegraph_token).create_page(
+ title = 'Mirror Bot Search',
+ author_name='Mirror Bot',
+ author_url='https://github.com/magneto261290/magneto-python-aria',
+ html_content=content
+ )['path'])
+
+ self.num_of_path = len(self.path)
+ if self.num_of_path > 1:
+ self.edit_telegraph()
msg = f"Search Results For {fileName} 👇"
buttons = button_build.ButtonMaker()
- buttons.buildbutton("HERE", f"https://telegra.ph/{response}")
+ buttons.buildbutton("HERE", f"https://telegra.ph/{self.path[0]}")
return msg, InlineKeyboardMarkup(buttons.build_menu(1))
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 568c012c4..711550dca 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -28,10 +28,10 @@ def sendMarkup(text: str, bot, update: Update, reply_markup: InlineKeyboardMarku
LOGGER.error(str(e))
-def editMessage(text: str, message: Message):
+def editMessage(text: str, message: Message, reply_markup=None):
try:
bot.edit_message_text(text=text, message_id=message.message_id,
- chat_id=message.chat.id,
+ chat_id=message.chat.id,reply_markup=reply_markup,
parse_mode='HTMl')
except Exception as e:
LOGGER.error(str(e))
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 40a2fff0f..0b15f0fdc 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -1,7 +1,7 @@
from telegram.ext import CommandHandler, run_async
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot import LOGGER, dispatcher
-from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup
+from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup, editMessage
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
@@ -10,13 +10,14 @@ def list_drive(update,context):
try:
search = update.message.text.split(' ',maxsplit=1)[1]
LOGGER.info(f"Searching: {search}")
+ reply = sendMessage('Searching..... Please wait!', context.bot, update)
gdrive = GoogleDriveHelper(None)
msg, button = gdrive.drive_list(search)
if button:
- sendMarkup(msg,context.bot,update,button)
+ editMessage(msg, reply, button)
else:
- sendMessage('No result found', context.bot, update)
+ editMessage('No result found', reply, button)
except IndexError:
sendMessage('send a search key along with command', context.bot, update)
From a68b83e8f7aa71ff40011788891a8b55cf5f285c Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Fri, 31 Jul 2020 03:27:11 +0530
Subject: [PATCH 034/190] check file in drive before mirror and stop duplicate
mirror
---
README.md | 1 +
bot/__init__.py | 8 +++++
.../download_utils/aria2_download.py | 15 +++++++++-
.../mirror_utils/upload_utils/gdriveTools.py | 29 +++++++++++++++++++
config_sample.env | 1 +
5 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3e572224d..3d706645e 100644
--- a/README.md
+++ b/README.md
@@ -114,6 +114,7 @@ python3 generate_string_session.py
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
- **MEGA_PASSWORD**: Your password for your mega.nz account
+- **STOP_DUPLICATE_MIRROR**: (Optional field) (Leave empty if unsure) if this field is set to `True` , bot will check file in drive, if it is present in drive, downloading will ne stopped. (Note - File will be checked using filename, not using filehash, so this feature is not perfect yet)
Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 2
## Getting Google OAuth API credential file
diff --git a/bot/__init__.py b/bot/__init__.py
index d7f4b8eb1..2e40fcdf8 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -125,6 +125,14 @@ def getConfig(name: str):
except KeyError:
BUTTON_FIVE_NAME = None
BUTTON_FIVE_URL = None
+try:
+ STOP_DUPLICATE_MIRROR = getConfig('STOP_DUPLICATE_MIRROR')
+ if STOP_DUPLICATE_MIRROR.lower() == 'true':
+ STOP_DUPLICATE_MIRROR = True
+ else:
+ STOP_DUPLICATE_MIRROR = False
+except KeyError:
+ STOP_DUPLICATE_MIRROR = False
try:
IS_TEAM_DRIVE = getConfig('IS_TEAM_DRIVE')
if IS_TEAM_DRIVE.lower() == 'true':
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index e85a07b04..3b8749630 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -1,4 +1,5 @@
-from bot import aria2
+from bot import aria2, download_dict_lock, STOP_DUPLICATE_MIRROR
+from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot.helper.ext_utils.bot_utils import *
from .download_helper import DownloadHelper
from bot.helper.mirror_utils.status_utils.aria_download_status import AriaDownloadStatus
@@ -15,7 +16,19 @@ def __init__(self):
@new_thread
def __onDownloadStarted(self, api, gid):
+ sleep(1.5)
LOGGER.info(f"onDownloadStart: {gid}")
+ dl = getDownloadByGid(gid)
+ download = api.get_download(gid)
+ self.name = download.name
+ sname = download.name
+ gdrive = GoogleDriveHelper(None)
+ smsg = gdrive.drive_slist(sname)
+ if STOP_DUPLICATE_MIRROR:
+ if smsg:
+ dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n Here are the search results:👇👇 \n\n{smsg}')
+ aria2.remove([download])
+ return
update_all_messages()
def __onDownloadComplete(self, api: API, gid):
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index d1c30acc2..45b5aa3e6 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -540,3 +540,32 @@ def drive_list(self, fileName):
else :
return '', ''
+
+ def drive_slist(self, fileName):
+ msg = ""
+ fileName = self.escapes(str(fileName))
+ # Create Search Query for API request.
+ query = f"'{parent_id}' in parents and (name contains '{fileName}')"
+ response = self.__service.files().list(supportsTeamDrives=True,
+ includeTeamDriveItems=True,
+ q=query,
+ spaces='drive',
+ pageSize=20,
+ fields='files(id, name, mimeType, size)',
+ orderBy='modifiedTime desc').execute()
+ for file in response.get('files', []):
+ if file.get(
+ 'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
+ msg += f"⁍ {file.get('name')}" \
+ f" (folder)"
+ if INDEX_URL is not None:
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
+ msg += f' | Index URL'
+ else:
+ msg += f"⁍ {file.get('name')} ({get_readable_file_size(int(file.get('size')))})"
+ if INDEX_URL is not None:
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ msg += f' | Index URL'
+ msg += '\n'
+ return msg
\ No newline at end of file
diff --git a/config_sample.env b/config_sample.env
index 5791a14da..9d31703fb 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -18,6 +18,7 @@ USE_SERVICE_ACCOUNTS = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
MEGA_PASSWORD = ""
+STOP_DUPLICATE_MIRROR = ""
# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
# If you don't know what are below entries, simply leave them, Don't fill anything in them.
BUTTON_THREE_NAME = ""
From e90950cb062c4fc4f0c1e41856ff1753019466b0 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Fri, 31 Jul 2020 09:20:59 +0530
Subject: [PATCH 035/190] Fixed duplicate mirror message issue
---
bot/modules/mirror.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 16e950e44..97ea8f86c 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -105,8 +105,6 @@ def onDownloadComplete(self):
drive.upload(up_name)
def onDownloadError(self, error):
- error = error.replace('<', ' ')
- error = error.replace('>', ' ')
LOGGER.info(self.update.effective_chat.id)
with download_dict_lock:
try:
From ff5caf80a54f23f9d5169b5a109b449dadb8b94c Mon Sep 17 00:00:00 2001
From: SVR666
Date: Tue, 11 Aug 2020 21:33:01 +0530
Subject: [PATCH 036/190] Some changes and fixup
---
.../download_utils/aria2_download.py | 8 +++--
.../mirror_utils/upload_utils/gdriveTools.py | 33 ++-----------------
bot/modules/mirror.py | 2 ++
3 files changed, 9 insertions(+), 34 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index 3b8749630..540b7258f 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -16,17 +16,19 @@ def __init__(self):
@new_thread
def __onDownloadStarted(self, api, gid):
- sleep(1.5)
+ sleep(1)
LOGGER.info(f"onDownloadStart: {gid}")
dl = getDownloadByGid(gid)
download = api.get_download(gid)
self.name = download.name
sname = download.name
gdrive = GoogleDriveHelper(None)
- smsg = gdrive.drive_slist(sname)
+ smsg, button = gdrive.drive_list(sname)
if STOP_DUPLICATE_MIRROR:
if smsg:
- dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n Here are the search results:👇👇 \n\n{smsg}')
+ dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
+ print(dl.getListener())
+ sendMarkup(" Here are the search results:👇👇", dl.getListener().bot, dl.getListener().update, button)
aria2.remove([download])
return
update_all_messages()
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 45b5aa3e6..67f5d8ac8 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -465,7 +465,7 @@ def edit_telegraph(self):
Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page],
title = 'Mirror Bot Search',
author_name='Mirror Bot',
- author_url='https://github.com/magneto261290/magneto-python-ariap',
+ author_url='https://github.com/magneto261290/magneto-python-aria',
html_content=content)
return
@@ -539,33 +539,4 @@ def drive_list(self, fileName):
return msg, InlineKeyboardMarkup(buttons.build_menu(1))
else :
- return '', ''
-
- def drive_slist(self, fileName):
- msg = ""
- fileName = self.escapes(str(fileName))
- # Create Search Query for API request.
- query = f"'{parent_id}' in parents and (name contains '{fileName}')"
- response = self.__service.files().list(supportsTeamDrives=True,
- includeTeamDriveItems=True,
- q=query,
- spaces='drive',
- pageSize=20,
- fields='files(id, name, mimeType, size)',
- orderBy='modifiedTime desc').execute()
- for file in response.get('files', []):
- if file.get(
- 'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
- msg += f"⁍ {file.get('name')}" \
- f" (folder)"
- if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
- msg += f' | Index URL'
- else:
- msg += f"⁍ {file.get('name')} ({get_readable_file_size(int(file.get('size')))})"
- if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
- msg += f' | Index URL'
- msg += '\n'
- return msg
\ No newline at end of file
+ return '', ''
\ No newline at end of file
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 97ea8f86c..16e950e44 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -105,6 +105,8 @@ def onDownloadComplete(self):
drive.upload(up_name)
def onDownloadError(self, error):
+ error = error.replace('<', ' ')
+ error = error.replace('>', ' ')
LOGGER.info(self.update.effective_chat.id)
with download_dict_lock:
try:
From 7ae2efdd96fd9ecfabd8ca89897c406791c0dd1d Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Tue, 11 Aug 2020 22:04:32 +0530
Subject: [PATCH 037/190] added ability of extracting iso, wim and many other
filetypes (see READMe)
---
README.md | 6 +-
bot/helper/ext_utils/fs_utils.py | 50 +++++++++++++
extract | 125 +++++++++++++++++++++++++++++++
3 files changed, 180 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3d706645e..944f06061 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,11 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Mirroring Mega.nz links to google drive (In development stage)
- Mirror Telegram files to google drive
- Mirror all youtube-dl supported links
-- Extract zip, rar, tar and many supported file types and uploads to google drive
+- Extract these filetypes and uploads to google drive
+> ZIP, RAR, TAR, 7z, ISO, WIM, CAB, GZIP, BZIP2,
+> APM, ARJ, CHM, CPIO, CramFS, DEB, DMG, FAT,
+> HFS, LZH, LZMA, LZMA2, MBR, MSI, MSLZ, NSIS,
+> NTFS, RPM, SquashFS, UDF, VHD, XAR, Z.
- Copy files from someone's drive to your drive (using Autorclone)
- Service account support in cloning and uploading
- Download progress
diff --git a/bot/helper/ext_utils/fs_utils.py b/bot/helper/ext_utils/fs_utils.py
index cbf50b20e..c73429dcc 100644
--- a/bot/helper/ext_utils/fs_utils.py
+++ b/bot/helper/ext_utils/fs_utils.py
@@ -80,6 +80,56 @@ def get_base_name(orig_path: str):
return orig_path.replace(".Z", "")
elif orig_path.endswith(".rar"):
return orig_path.replace(".rar", "")
+ elif orig_path.endswith(".iso"):
+ return orig_path.replace(".iso", "")
+ elif orig_path.endswith(".wim"):
+ return orig_path.replace(".wim", "")
+ elif orig_path.endswith(".cab"):
+ return orig_path.replace(".cab", "")
+ elif orig_path.endswith(".apm"):
+ return orig_path.replace(".apm", "")
+ elif orig_path.endswith(".arj"):
+ return orig_path.replace(".arj", "")
+ elif orig_path.endswith(".chm"):
+ return orig_path.replace(".chm", "")
+ elif orig_path.endswith(".cpio"):
+ return orig_path.replace(".cpio", "")
+ elif orig_path.endswith(".cramfs"):
+ return orig_path.replace(".cramfs", "")
+ elif orig_path.endswith(".deb"):
+ return orig_path.replace(".deb", "")
+ elif orig_path.endswith(".dmg"):
+ return orig_path.replace(".dmg", "")
+ elif orig_path.endswith(".fat"):
+ return orig_path.replace(".fat", "")
+ elif orig_path.endswith(".hfs"):
+ return orig_path.replace(".hfs", "")
+ elif orig_path.endswith(".lzh"):
+ return orig_path.replace(".lzh", "")
+ elif orig_path.endswith(".lzma"):
+ return orig_path.replace(".lzma", "")
+ elif orig_path.endswith(".lzma2"):
+ return orig_path.replace(".lzma2", "")
+ elif orig_path.endswith(".mbr"):
+ return orig_path.replace(".mbr", "")
+ elif orig_path.endswith(".msi"):
+ return orig_path.replace(".msi", "")
+ elif orig_path.endswith(".mslz"):
+ return orig_path.replace(".mslz", "")
+ elif orig_path.endswith(".nsis"):
+ return orig_path.replace(".nsis", "")
+ elif orig_path.endswith(".ntfs"):
+ return orig_path.replace(".ntfs", "")
+ elif orig_path.endswith(".rpm"):
+ return orig_path.replace(".rpm", "")
+ elif orig_path.endswith(".squashfs"):
+ return orig_path.replace(".squashfs", "")
+ elif orig_path.endswith(".udf"):
+ return orig_path.replace(".udf", "")
+ elif orig_path.endswith(".vhd"):
+ return orig_path.replace(".vhd", "")
+ elif orig_path.endswith(".xar"):
+ return orig_path.replace(".xar", "")
else:
raise NotSupportedExtractionArchive('File format not supported for extraction')
diff --git a/extract b/extract
index ed175f307..bd05693c6 100755
--- a/extract
+++ b/extract
@@ -57,6 +57,131 @@ extract() {
7z x "$arg" -o"$a_dir"
local code=$?
;;
+ *.iso)
+ a_dir=$(expr "$arg" : '\(.*\).iso')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.wim)
+ a_dir=$(expr "$arg" : '\(.*\).wim')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.cab)
+ a_dir=$(expr "$arg" : '\(.*\).cab')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.apm)
+ a_dir=$(expr "$arg" : '\(.*\).apm')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.arj)
+ a_dir=$(expr "$arg" : '\(.*\).arj')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.chm)
+ a_dir=$(expr "$arg" : '\(.*\).chm')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.cpio)
+ a_dir=$(expr "$arg" : '\(.*\).cpio')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.cramfs)
+ a_dir=$(expr "$arg" : '\(.*\).cramfs')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.deb)
+ a_dir=$(expr "$arg" : '\(.*\).deb')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.dmg)
+ a_dir=$(expr "$arg" : '\(.*\).dmg')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.fat)
+ a_dir=$(expr "$arg" : '\(.*\).fat')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.hfs)
+ a_dir=$(expr "$arg" : '\(.*\).hfs')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.lzh)
+ a_dir=$(expr "$arg" : '\(.*\).lzh')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.lzma)
+ a_dir=$(expr "$arg" : '\(.*\).lzma')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.lzma2)
+ a_dir=$(expr "$arg" : '\(.*\).lzma2')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.mbr)
+ a_dir=$(expr "$arg" : '\(.*\).mbr')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.msi)
+ a_dir=$(expr "$arg" : '\(.*\).msi')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.mslz)
+ a_dir=$(expr "$arg" : '\(.*\).mslz')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.nsis)
+ a_dir=$(expr "$arg" : '\(.*\).nsis')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.ntfs)
+ a_dir=$(expr "$arg" : '\(.*\).ntfs')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.rpm)
+ a_dir=$(expr "$arg" : '\(.*\).rpm')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.squashfs)
+ a_dir=$(expr "$arg" : '\(.*\).squashfs')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.udf)
+ a_dir=$(expr "$arg" : '\(.*\).udf')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.vhd)
+ a_dir=$(expr "$arg" : '\(.*\).vhd')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
+ *.xar)
+ a_dir=$(expr "$arg" : '\(.*\).xar')
+ 7z x "$arg" -o"$a_dir"
+ local code=$?
+ ;;
*)
echo "'$arg' cannot be extracted via extract()" 1>&2
exit 1
From 826c8b4700a5aaa8d6768076299af0f823c15fcf Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Tue, 11 Aug 2020 22:18:45 +0530
Subject: [PATCH 038/190] Added overall DL, UL speed in /status. Thanks to
[Dark Soul](https://t.me/iamvishalg)
---
bot/helper/ext_utils/bot_utils.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 1c42736b9..3dfd7ead2 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -90,14 +90,21 @@ def get_progress_bar_string(status):
def get_readable_message():
with download_dict_lock:
+ dlspeed_bytes = 0
+ uldl_bytes = 0
msg = ""
for download in list(download_dict.values()):
+ speedy = download.speed()
msg += f"Filename : {download.name()}"
msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}" \
f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}" \
f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
+ if 'KiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('M')[0]) * 1048576
# if hasattr(download, 'is_torrent'):
try:
msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
@@ -106,7 +113,15 @@ def get_readable_message():
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
msg += f"\nGID: {download.gid()}"
+ if download.status() == MirrorStatus.STATUS_UPLOADING:
+ if 'KB/s' in speedy:
+ uldl_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MB/s' in speedy:
+ uldl_bytes += float(speedy.split('M')[0]) * 1048576
msg += "\n\n"
+ dlspeed = get_readable_file_size(dlspeed_bytes)
+ ulspeed = get_readable_file_size(uldl_bytes)
+ msg += f"DL:{dlspeed}ps ?? | UL:{ulspeed}ps ??\n"
return msg
From becf2aef4ca2019f9e7448ba2fbbc9056dc6b955 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Mon, 17 Aug 2020 21:50:21 +0530
Subject: [PATCH 039/190] Fix: status message on no active downloads was
showing cpu stats
---
bot/helper/ext_utils/bot_utils.py | 15 --------
bot/helper/telegram_helper/message_utils.py | 42 +++++++++++++++++++--
2 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 3dfd7ead2..1c42736b9 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -90,21 +90,14 @@ def get_progress_bar_string(status):
def get_readable_message():
with download_dict_lock:
- dlspeed_bytes = 0
- uldl_bytes = 0
msg = ""
for download in list(download_dict.values()):
- speedy = download.speed()
msg += f"Filename : {download.name()}"
msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}" \
f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}" \
f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
- if 'KiB/s' in speedy:
- dlspeed_bytes += float(speedy.split('K')[0]) * 1024
- elif 'MiB/s' in speedy:
- dlspeed_bytes += float(speedy.split('M')[0]) * 1048576
# if hasattr(download, 'is_torrent'):
try:
msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
@@ -113,15 +106,7 @@ def get_readable_message():
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
msg += f"\nGID: {download.gid()}"
- if download.status() == MirrorStatus.STATUS_UPLOADING:
- if 'KB/s' in speedy:
- uldl_bytes += float(speedy.split('K')[0]) * 1024
- elif 'MB/s' in speedy:
- uldl_bytes += float(speedy.split('M')[0]) * 1048576
msg += "\n\n"
- dlspeed = get_readable_file_size(dlspeed_bytes)
- ulspeed = get_readable_file_size(uldl_bytes)
- msg += f"DL:{dlspeed}ps ?? | UL:{ulspeed}ps ??\n"
return msg
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 711550dca..2114b7894 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -4,11 +4,9 @@
import time
import psutil
from bot import AUTO_DELETE_MESSAGE_DURATION, LOGGER, bot, \
- status_reply_dict, status_reply_dict_lock
-from bot.helper.ext_utils.bot_utils import get_readable_message
+ status_reply_dict, status_reply_dict_lock, download_dict, download_dict_lock
+from bot.helper.ext_utils.bot_utils import get_readable_message, get_readable_file_size, MirrorStatus
from telegram.error import TimedOut, BadRequest
-from bot import bot
-
def sendMessage(text: str, bot, update: Update):
try:
@@ -78,6 +76,24 @@ def update_all_messages():
msg += f"CPU: {psutil.cpu_percent()}%" \
f" DISK: {psutil.disk_usage('/').percent}%" \
f" RAM: {psutil.virtual_memory().percent}%"
+ with download_dict_lock:
+ dlspeed_bytes = 0
+ uldl_bytes = 0
+ for download in list(download_dict.values()):
+ speedy = download.speed()
+ if download.status() == MirrorStatus.STATUS_DOWNLOADING:
+ if 'KiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('M')[0]) * 1048576
+ if download.status() == MirrorStatus.STATUS_UPLOADING:
+ if 'KB/s' in speedy:
+ uldl_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MB/s' in speedy:
+ uldl_bytes += float(speedy.split('M')[0]) * 1048576
+ dlspeed = get_readable_file_size(dlspeed_bytes)
+ ulspeed = get_readable_file_size(uldl_bytes)
+ msg += f"\nDL:{dlspeed}ps 🔻| UL:{ulspeed}ps 🔺\n"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -93,6 +109,24 @@ def sendStatusMessage(msg, bot):
progress += f"CPU: {psutil.cpu_percent()}%" \
f" DISK: {psutil.disk_usage('/').percent}%" \
f" RAM: {psutil.virtual_memory().percent}%"
+ with download_dict_lock:
+ dlspeed_bytes = 0
+ uldl_bytes = 0
+ for download in list(download_dict.values()):
+ speedy = download.speed()
+ if download.status() == MirrorStatus.STATUS_DOWNLOADING:
+ if 'KiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MiB/s' in speedy:
+ dlspeed_bytes += float(speedy.split('M')[0]) * 1048576
+ if download.status() == MirrorStatus.STATUS_UPLOADING:
+ if 'KB/s' in speedy:
+ uldl_bytes += float(speedy.split('K')[0]) * 1024
+ elif 'MB/s' in speedy:
+ uldl_bytes += float(speedy.split('M')[0]) * 1048576
+ dlspeed = get_readable_file_size(dlspeed_bytes)
+ ulspeed = get_readable_file_size(uldl_bytes)
+ progress += f"\nDL:{dlspeed}ps 🔻| UL:{ulspeed}ps 🔺\n"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:
From 48fd14475ca39bdfe516d41619fb8a54e1729936 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Wed, 26 Aug 2020 12:29:25 +0530
Subject: [PATCH 040/190] Added option to disable mega.nz links
(config_sample.env)
---
README.md | 1 +
bot/__init__.py | 9 +++++++++
bot/modules/mirror.py | 12 ++++++++----
config_sample.env | 1 +
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 944f06061..804513531 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,7 @@ python3 generate_string_session.py
- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
- **MEGA_PASSWORD**: Your password for your mega.nz account
- **STOP_DUPLICATE_MIRROR**: (Optional field) (Leave empty if unsure) if this field is set to `True` , bot will check file in drive, if it is present in drive, downloading will ne stopped. (Note - File will be checked using filename, not using filehash, so this feature is not perfect yet)
+- **BLOCK_MEGA_LINKS**: (Optional field) If you want to remove mega.nz mirror support (bcoz it's too much buggy and unstable), set it to `True`.
Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 2
## Getting Google OAuth API credential file
diff --git a/bot/__init__.py b/bot/__init__.py
index 2e40fcdf8..5f6bc917f 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -151,6 +151,15 @@ def getConfig(name: str):
except KeyError:
USE_SERVICE_ACCOUNTS = False
+try:
+ BLOCK_MEGA_LINKS = getConfig('BLOCK_MEGA_LINKS')
+ if BLOCK_MEGA_LINKS.lower() == 'true':
+ BLOCK_MEGA_LINKS = True
+ else:
+ BLOCK_MEGA_LINKS = False
+except KeyError:
+ BLOCK_MEGA_LINKS = False
+
updater = tg.Updater(token=BOT_TOKEN,use_context=True)
bot = updater.bot
dispatcher = updater.dispatcher
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 16e950e44..c1faa1ae8 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -2,7 +2,7 @@
from telegram.ext import CommandHandler, run_async
from telegram import InlineKeyboardMarkup
-from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL
+from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
@@ -229,11 +229,15 @@ def _mirror(bot, update, isTar=False, extract=False):
LOGGER.info(f'{link}: {e}')
listener = MirrorListener(bot, update, isTar, tag, extract)
if bot_utils.is_mega_link(link):
- mega_dl = MegaDownloadHelper()
- mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
+ if BLOCK_MEGA_LINKS:
+ sendMessage("Mega links are blocked bcoz mega downloading is too much unstable and buggy. mega support will be added back after fix", bot, update)
+ else:
+ mega_dl = MegaDownloadHelper()
+ mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
+ sendStatusMessage(update, bot)
else:
ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
- sendStatusMessage(update, bot)
+ sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
diff --git a/config_sample.env b/config_sample.env
index 9d31703fb..63b81eba8 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -19,6 +19,7 @@ MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
MEGA_PASSWORD = ""
STOP_DUPLICATE_MIRROR = ""
+BLOCK_MEGA_LINKS = ""
# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
# If you don't know what are below entries, simply leave them, Don't fill anything in them.
BUTTON_THREE_NAME = ""
From 581f61dcdfcc4eadd29cdfd3dc6798d115b2baaa Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sat, 29 Aug 2020 10:31:56 +0530
Subject: [PATCH 041/190] Enable faulthandler
---
bot/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bot/__init__.py b/bot/__init__.py
index a42a0aebb..677a4517d 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -7,6 +7,8 @@
import telegram.ext as tg
from dotenv import load_dotenv
import socket
+import faulthandler
+faulthandler.enable()
socket.setdefaulttimeout(600)
From 4179e61fcc6614cc67722ef0b7726643b48249af Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sat, 29 Aug 2020 10:35:58 +0530
Subject: [PATCH 042/190] Mega: Fix folder downloads with mega account
---
bot/helper/ext_utils/bot_utils.py | 9 ++++
.../download_utils/mega_downloader.py | 51 +++++++++++--------
2 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 35452f259..add45d999 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -143,6 +143,15 @@ def is_magnet(url: str):
def is_mega_link(url: str):
return "mega.nz" in url
+def get_mega_link_type(url: str):
+ if "folder" in url:
+ return "folder"
+ elif "file" in url:
+ return "file"
+ elif "/#F!" in url:
+ return "folder"
+ return "file"
+
def new_thread(fn):
"""To use as decorator to make a function call threaded.
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 081356a0e..8a7fff574 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -3,6 +3,7 @@
from mega import (MegaApi, MegaListener, MegaRequest, MegaTransfer, MegaError)
from bot.helper.telegram_helper.message_utils import update_all_messages
import os
+from bot.helper.ext_utils.bot_utils import new_thread, get_mega_link_type
from bot.helper.mirror_utils.status_utils.mega_download_status import MegaDownloadStatus
import random
import string
@@ -12,12 +13,13 @@ class MegaDownloaderException(Exception):
class MegaAppListener(MegaListener):
- _NO_EVENT_ON = (MegaRequest.TYPE_LOGIN,
- MegaRequest.TYPE_FETCH_NODES)
+ _NO_EVENT_ON = (MegaRequest.TYPE_LOGIN,MegaRequest.TYPE_FETCH_NODES)
+ NO_ERROR = "no error"
def __init__(self, continue_event: threading.Event, listener):
self.continue_event = continue_event
self.node = None
+ self.public_node = None
self.listener = listener
self.uid = listener.uid
self.__bytes_transferred = 0
@@ -64,15 +66,19 @@ def onRequestFinish(self, api, request, error):
if request_type == MegaRequest.TYPE_LOGIN:
api.fetchNodes()
elif request_type == MegaRequest.TYPE_GET_PUBLIC_NODE:
- self.node = request.getPublicMegaNode()
+ self.public_node = request.getPublicMegaNode()
elif request_type == MegaRequest.TYPE_FETCH_NODES:
LOGGER.info("Fetching Root Node.")
self.node = api.getRootNode()
- if request_type not in self._NO_EVENT_ON:
+ LOGGER.info(f"Node Name: {self.node.getName()}")
+ if request_type not in self._NO_EVENT_ON or self.node and "cloud drive" not in self.node.getName().lower():
self.continue_event.set()
def onRequestTemporaryError(self, api, request, error: MegaError):
- self.listener.onDownloadError(error.toString())
+ LOGGER.info(f'Mega Request error in {error}')
+ if not self.is_cancelled:
+ self.listener.onDownloadError("RequestTempError: " + error.toString())
+ self.is_cancelled = True
self.error = error.toString()
self.continue_event.set()
@@ -88,22 +94,22 @@ def onTransferUpdate(self, api: MegaApi, transfer: MegaTransfer):
def onTransferFinish(self, api: MegaApi, transfer: MegaTransfer, error):
try:
LOGGER.info(f'Transfer finished ({transfer}); Result: {transfer.getFileName()}')
- if str(error) != "No error" and self.is_cancelled:
- self.is_cancelled = False
- return self.listener.onDownloadError(error.toString())
- if transfer.isFolderTransfer() and transfer.isFinished() and not self.is_cancelled or transfer.getFileName() == self.name and not self.is_cancelled:
+ if transfer.isFolderTransfer() and transfer.isFinished() or transfer.getFileName() == self.name and not self.is_cancelled:
self.listener.onDownloadComplete()
+ self.continue_event.set()
except Exception as e:
LOGGER.error(e)
def onTransferTemporaryError(self, api, transfer, error):
LOGGER.info(f'Mega download error in file {transfer} {transfer.getFileName()}: {error}')
- self.listener.onDownloadError(error.toString())
self.error = error.toString()
- self.continue_event.set()
+ if not self.is_cancelled:
+ self.is_cancelled = True
+ self.listener.onDownloadError("TransferTempError: "+self.error)
def cancel_download(self):
self.is_cancelled = True
+ self.listener.onDownloadError("Download Canceled by user")
class AsyncExecutor:
@@ -122,26 +128,31 @@ def __init__(self):
pass
@staticmethod
+ @new_thread
def add_download(mega_link: str, path: str, listener):
if MEGA_API_KEY is None:
raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror mega links')
executor = AsyncExecutor()
api = MegaApi(MEGA_API_KEY, None, None, 'telegram-mirror-bot')
mega_listener = MegaAppListener(executor.continue_event, listener)
+ with download_dict_lock:
+ download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
os.makedirs(path)
api.addListener(mega_listener)
if MEGA_EMAIL_ID is not None and MEGA_PASSWORD is not None:
executor.do(api.login, (MEGA_EMAIL_ID, MEGA_PASSWORD))
- executor.do(api.getPublicNode, (mega_link,))
- node = mega_listener.node
- if node is None:
- executor.do(api.loginToFolder, (mega_link,))
- node = mega_listener.node
+ link_type = get_mega_link_type(mega_link)
+ if link_type == "file":
+ executor.do(api.getPublicNode, (mega_link,))
+ node = mega_listener.public_node
+ else:
+ LOGGER.info("Logging into mega folder")
+ folder_api = MegaApi(MEGA_API_KEY,None,None,'TgBot')
+ folder_api.addListener(mega_listener)
+ executor.do(folder_api.loginToFolder, (mega_link,))
+ node = folder_api.authorizeNode(mega_listener.node)
if mega_listener.error is not None:
return listener.onDownloadError(str(mega_listener.error))
gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
mega_listener.setValues(node.getName(), api.getSize(node), gid)
- with download_dict_lock:
- download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
- threading.Thread(target=executor.do, args=(api.startDownload, (node, path))).start()
- update_all_messages()
+ executor.do(api.startDownload,(node,path))
From 2ee56255285e67936ec1cecf116d43c3505e6354 Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sat, 29 Aug 2020 10:36:59 +0530
Subject: [PATCH 043/190] message_utils: handle edge case
---
bot/helper/telegram_helper/message_utils.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 9d3eb02c5..856981907 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -67,6 +67,8 @@ def update_all_messages():
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
+ if len(msg) == 0:
+ msg = "Starting DL"
try:
editMessage(msg, status_reply_dict[chat_id])
except Exception as e:
@@ -86,5 +88,7 @@ def sendStatusMessage(msg, bot):
LOGGER.error(str(e))
del status_reply_dict[msg.message.chat.id]
pass
+ if len(progress) == 0:
+ progress = "Starting DL"
message = sendMessage(progress, bot, msg)
status_reply_dict[msg.message.chat.id] = message
From a6a4b035b969d419b5c236c6f9b233b8f0d127f8 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sat, 29 Aug 2020 17:38:43 +0530
Subject: [PATCH 044/190] Added support of jiosaavn, tiktok, instagram reels
Support of tiktok without watermark videos
---
requirements.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 2b7284c8d..a3d70def4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,6 +11,6 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram>=0.16.0,<0.16.10
TgCrypto>=1.1.1,<1.1.10
-git+git://github.com/lzzy12/youtube-dl@d7c2b43#youtube_dl
+git+https://github.com/magneto261290/youtube-dl
lxml
-telegraph
\ No newline at end of file
+telegraph
From 7f1ce2758f7fd45a706e51eb2615ec63d12a7af5 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Wed, 2 Sep 2020 17:02:37 +0530
Subject: [PATCH 045/190] Added url Shorteners support (Optional)
---
README.md | 9 +++
bot/__init__.py | 9 +++
.../youtube_dl_download_helper.py | 2 +-
.../mirror_utils/upload_utils/gdriveTools.py | 60 +++++++++++++++----
bot/modules/mirror.py | 14 ++++-
config_sample.env | 5 +-
6 files changed, 81 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 804513531..c3aec9ef4 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Docker support
- Uploading To Team Drives.
- Index Link support
+- Shortener support
## Bot commands to be set in botfather
@@ -120,6 +121,14 @@ python3 generate_string_session.py
- **MEGA_PASSWORD**: Your password for your mega.nz account
- **STOP_DUPLICATE_MIRROR**: (Optional field) (Leave empty if unsure) if this field is set to `True` , bot will check file in drive, if it is present in drive, downloading will ne stopped. (Note - File will be checked using filename, not using filehash, so this feature is not perfect yet)
- **BLOCK_MEGA_LINKS**: (Optional field) If you want to remove mega.nz mirror support (bcoz it's too much buggy and unstable), set it to `True`.
+- **SHORTENER**: (Optional field) if you want to use shortener in Gdrive and index link, fill shotener url here. Examples :-
+> exe.io
+> gplinks.in
+> shrinkme.io
+> urlshortx.com
+> shortzon.com
+Note :- Above are the supported url shorteners. Except these only some url shorteners are supported. If you want to use any other url shortener then first ask me that shortener is supported or not.
+- **SHORTENER_API**: Fill your shortener api key if you are using shortener.
Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 2
## Getting Google OAuth API credential file
diff --git a/bot/__init__.py b/bot/__init__.py
index df52aaea2..f29b94ec3 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -162,6 +162,15 @@ def getConfig(name: str):
except KeyError:
BLOCK_MEGA_LINKS = False
+try:
+ SHORTENER = getConfig('SHORTENER')
+ SHORTENER_API = getConfig('SHORTENER_API')
+ if len(SHORTENER) == 0 or len(SHORTENER_API) == 0:
+ raise KeyError
+except KeyError:
+ SHORTENER = None
+ SHORTENER_API = None
+
updater = tg.Updater(token=BOT_TOKEN,use_context=True)
bot = updater.bot
dispatcher = updater.dispatcher
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index ca07ec1bf..7e2020b38 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -96,7 +96,7 @@ def onDownloadError(self, error):
self.__listener.onDownloadError(error)
def extractMetaData(self, link):
- if 'hotstar' in link:
+ if 'hotstar' or 'sonyliv' in link:
self.opts['geo_bypass_country'] = 'IN'
with YoutubeDL(self.opts) as ydl:
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 67f5d8ac8..fefb171c2 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -21,7 +21,7 @@
from telegraph import Telegraph
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
- USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL
+ USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, SHORTENER, SHORTENER_API
from bot.helper.ext_utils.bot_utils import *
from bot.helper.ext_utils.fs_utils import get_mime_type
@@ -320,11 +320,20 @@ def clone(self, link):
dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
msg += f'Filename : {meta.get("name")}\nSize : {get_readable_file_size(self.transferred_size)}'
+ durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
buttons = button_build.ButtonMaker()
- buttons.buildbutton("⚡Drive Link⚡", self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id))
+ if SHORTENER is not None and SHORTENER_API is not None:
+ surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
+ buttons.buildbutton("⚡Drive Link⚡", surl)
+ else:
+ buttons.buildbutton("⚡Drive Link⚡", durl)
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
- buttons.buildbutton("💥Index Link💥", url)
+ if SHORTENER is not None and SHORTENER_API is not None:
+ siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ buttons.buildbutton("💥Index Link💥", siurl)
+ else:
+ buttons.buildbutton("💥Index Link💥", url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
@@ -334,14 +343,23 @@ def clone(self, link):
else:
file = self.copyFile(meta.get('id'), parent_id)
msg += f'Filename : {file.get("name")}'
+ durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id"))
buttons = button_build.ButtonMaker()
- buttons.buildbutton("⚡Drive Link⚡", self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id")))
+ if SHORTENER is not None and SHORTENER_API is not None:
+ surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
+ buttons.buildbutton("⚡Drive Link⚡", surl)
+ else:
+ buttons.buildbutton("⚡Drive Link⚡", durl)
try:
msg += f'\nSize : {get_readable_file_size(int(meta.get("size")))}'
except TypeError:
pass
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ if SHORTENER is not None and SHORTENER_API is not None:
+ siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ buttons.buildbutton("💥Index Link💥", siurl)
+ else:
buttons.buildbutton("💥Index Link💥", url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
@@ -494,19 +512,35 @@ def drive_list(self, fileName):
for file in response.get('files', []):
if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
- msg += f"⁍{file.get('name')}
(folder📁)
" \
- f"Drive Link"
+ furl = f"https://drive.google.com/drive/folders/{file.get('id')}"
+ msg += f"⁍{file.get('name')}
(folder📁)
"
+ if SHORTENER is not None and SHORTENER_API is not None:
+ sfurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text
+ msg += f"Drive Link"
+ else:
+ msg += f"Drive Link"
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
- msg += f' | Index Link'
-
+ if SHORTENER is not None and SHORTENER_API is not None:
+ siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ msg += f' | Index Link'
+ else:
+ msg += f' | Index Link'
else:
- msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
" \
- f"Drive Link"
+ furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download"
+ msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
"
+ if SHORTENER is not None and SHORTENER_API is not None:
+ sfurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text
+ msg += f"Drive Link"
+ else:
+ msg += f"Drive Link"
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
- msg += f' | Index Link'
-
+ if SHORTENER is not None and SHORTENER_API is not None:
+ siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ msg += f' | Index Link'
+ else:
+ msg += f' | Index Link'
msg += '
'
content_count += 1
if content_count == TELEGRAPHLIMIT :
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index c1faa1ae8..e93cd0c61 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -3,7 +3,7 @@
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
-from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock
+from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock, SHORTENER, SHORTENER_API
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException, NotSupportedExtractionArchive
@@ -140,13 +140,21 @@ def onUploadComplete(self, link: str):
with download_dict_lock:
msg = f'Filename : {download_dict[self.uid].name()}\nSize : {download_dict[self.uid].size()}'
buttons = button_build.ButtonMaker()
- buttons.buildbutton("⚡Drive Link⚡", link)
+ if SHORTENER is not None and SHORTENER_API is not None:
+ surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
+ buttons.buildbutton("⚡Drive Link⚡", surl)
+ else:
+ buttons.buildbutton("⚡Drive Link⚡", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}')
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
- buttons.buildbutton("💥Index Link💥", share_url)
+ if SHORTENER is not None and SHORTENER_API is not None:
+ siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
+ buttons.buildbutton("💥Index Link💥", siurl)
+ else:
+ buttons.buildbutton("💥Index Link💥", share_url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
diff --git a/config_sample.env b/config_sample.env
index 63b81eba8..56c7dda9a 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -10,16 +10,19 @@ DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = ""
-INDEX_URL = ""
USER_SESSION_STRING = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
USE_SERVICE_ACCOUNTS = ""
+# Optional config
+INDEX_URL = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
MEGA_PASSWORD = ""
STOP_DUPLICATE_MIRROR = ""
BLOCK_MEGA_LINKS = ""
+SHORTENER = ""
+SHORTENER_API = ""
# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
# If you don't know what are below entries, simply leave them, Don't fill anything in them.
BUTTON_THREE_NAME = ""
From bc19c600b73a381dcc0f74cc052530880b454de9 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Wed, 2 Sep 2020 17:27:11 +0530
Subject: [PATCH 046/190] Update README.md
---
README.md | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index c3aec9ef4..2d9abd907 100644
--- a/README.md
+++ b/README.md
@@ -122,14 +122,21 @@ python3 generate_string_session.py
- **STOP_DUPLICATE_MIRROR**: (Optional field) (Leave empty if unsure) if this field is set to `True` , bot will check file in drive, if it is present in drive, downloading will ne stopped. (Note - File will be checked using filename, not using filehash, so this feature is not perfect yet)
- **BLOCK_MEGA_LINKS**: (Optional field) If you want to remove mega.nz mirror support (bcoz it's too much buggy and unstable), set it to `True`.
- **SHORTENER**: (Optional field) if you want to use shortener in Gdrive and index link, fill shotener url here. Examples :-
+
> exe.io
+
> gplinks.in
+
> shrinkme.io
+
> urlshortx.com
+
> shortzon.com
+
Note :- Above are the supported url shorteners. Except these only some url shorteners are supported. If you want to use any other url shortener then first ask me that shortener is supported or not.
- **SHORTENER_API**: Fill your shortener api key if you are using shortener.
-Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 2
+
+Note: You can limit maximum concurrent downloads by changing the value of MAX_CONCURRENT_DOWNLOADS in aria.sh. By default, it's set to 4
## Getting Google OAuth API credential file
@@ -194,4 +201,4 @@ For using your premium accounts in youtube-dl, edit the netrc file (in the root
```
machine host login username password my_youtube_password
```
-where host is the name of extractor (eg. youtube, twitch). Multiple accounts of different hosts can be added each separated by a new line
\ No newline at end of file
+where host is the name of extractor (eg. youtube, twitch). Multiple accounts of different hosts can be added each separated by a new line
From 0ac287f6f1a8b0b555567175c5eda69525e877f2 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Wed, 9 Sep 2020 13:51:42 +0530
Subject: [PATCH 047/190] Some peps were facing issue in generating string
session.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2d9abd907..f9822414f 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ python3 generate_telegraph_token.py
- **INDEX_URL** : (Optional field) Refer to https://github.com/maple3142/GDIndex/ The URL should not have any trailing '/'
- **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
-- **USER_SESSION_STRING** : Session string generated by running:
+- **USER_SESSION_STRING** : Generate String session by [clicking here](https://generatestringsession.magneto261290.repl.run/) **OR** you can generate by running :
```
python3 generate_string_session.py
```
From b68e874747d3b0d240d63e2302a83c37adff3cea Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sat, 24 Oct 2020 18:02:34 +0530
Subject: [PATCH 048/190] Changed Youtube-dl's repo (Note :- Tiktok broken)
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index a3d70def4..26e53ab5c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,6 +11,6 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram>=0.16.0,<0.16.10
TgCrypto>=1.1.1,<1.1.10
-git+https://github.com/magneto261290/youtube-dl
+git+https://gitlab.com/magneto261290/youtube-dl
lxml
telegraph
From e9d935e6146e89d4687b06607977f33fd46468e4 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Thu, 5 Nov 2020 02:45:01 +0530
Subject: [PATCH 049/190] Added quality option in /watch command
---
bot/__main__.py | 2 +-
.../youtube_dl_download_helper.py | 17 ++++++++++++-----
bot/modules/watch.py | 12 ++++++++++--
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index c70453675..1a9352d41 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -83,7 +83,7 @@ def bot_help(update, context):
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: start mirroring and upload the archived (.tar) version of the download
-/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl
+/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help.
/{BotCommands.TarWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and tar before uploading
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 7e2020b38..57ee23a93 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -40,8 +40,7 @@ def __init__(self, listener):
self.opts = {
'progress_hooks': [self.__onDownloadProgress],
'logger': MyLogger(self),
- 'usenetrc': True,
- 'format': "best/bestvideo+bestaudio"
+ 'usenetrc': True
}
self.__download_speed = 0
self.download_speed_readable = ''
@@ -95,7 +94,7 @@ def __onDownloadComplete(self):
def onDownloadError(self, error):
self.__listener.onDownloadError(error)
- def extractMetaData(self, link):
+ def extractMetaData(self, link, qual):
if 'hotstar' or 'sonyliv' in link:
self.opts['geo_bypass_country'] = 'IN'
@@ -103,6 +102,9 @@ def extractMetaData(self, link):
try:
result = ydl.extract_info(link, download=False)
name = ydl.prepare_filename(result)
+ # noobway hack for changing extension after converting to mp3
+ if qual == "audio":
+ name = name.replace(".mp4", ".mp3").replace(".webm", ".mp3")
except DownloadError as e:
self.onDownloadError(str(e))
return
@@ -138,11 +140,16 @@ def __download(self, link):
LOGGER.info("Download Cancelled by User!")
self.onDownloadError("Download Cancelled by User!")
- def add_download(self, link, path):
+ def add_download(self, link, path, qual):
self.__onDownloadStart()
- self.extractMetaData(link)
+ self.extractMetaData(link, qual)
LOGGER.info(f"Downloading with YT-DL: {link}")
self.__gid = f"{self.vid_id}{self.__listener.uid}"
+ if qual == "audio":
+ self.opts['format'] = 'bestaudio/best'
+ self.opts['postprocessors'] = [{'key': 'FFmpegExtractAudio','preferredcodec': 'mp3','preferredquality': '192',}]
+ else:
+ self.opts['format'] = qual
if not self.is_playlist:
self.opts['outtmpl'] = f"{path}/{self.name}"
else:
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index 42bdb1d70..a2ec2d740 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -14,8 +14,16 @@ def _watch(bot: Bot, update: Update, args: list, isTar=False):
try:
link = args[0]
except IndexError:
- sendMessage(f'/{BotCommands.WatchCommand} [yt_dl supported link] to mirror with youtube_dl', bot, update)
+ msg = f"/{BotCommands.WatchCommand} [yt_dl supported link] [quality] to mirror with youtube_dl.\n\n"
+ msg += "Example of quality :- audio, 144, 360, 720, 1080.\nNote :- Quality is optional"
+ sendMessage(msg, bot, update)
return
+ try:
+ qual = args[1]
+ if qual != "audio":
+ qual = f'bestvideo[height<={qual}]+bestaudio/best[height<={qual}]'
+ except IndexError:
+ qual = "bestvideo+bestaudio/best"
reply_to = update.message.reply_to_message
if reply_to is not None:
tag = reply_to.from_user.username
@@ -24,7 +32,7 @@ def _watch(bot: Bot, update: Update, args: list, isTar=False):
listener = MirrorListener(bot, update, isTar, tag)
ydl = YoutubeDLHelper(listener)
- threading.Thread(target=ydl.add_download,args=(link, f'{DOWNLOAD_DIR}{listener.uid}')).start()
+ threading.Thread(target=ydl.add_download,args=(link, f'{DOWNLOAD_DIR}{listener.uid}', qual)).start()
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
From 31b8e02468975afd35c025dbbb61524aadc851f6 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sat, 7 Nov 2020 15:31:35 +0530
Subject: [PATCH 050/190] Try to fix 0B size shown by YTDL
Size while downloading has not been fixed yet. So it can show double size while downloading and will not show Total size. I have fixed total size while uploading and after upload. I have also fixed wrong file size after uplaod of extracted items. Sometime size is greater than compressed file after extracting compressed files. Now it will show correct file size
---
.../status_utils/youtube_dl_download_status.py | 7 +++++--
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 5 +++--
bot/modules/mirror.py | 8 ++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py b/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
index a29013d79..089068ca0 100644
--- a/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
+++ b/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
@@ -1,7 +1,7 @@
from bot import DOWNLOAD_DIR
from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time
from .status import Status
-
+from bot.helper.ext_utils.fs_utils import get_path_size
class YoutubeDLDownloadStatus(Status):
def __init__(self, obj, listener):
@@ -16,7 +16,10 @@ def path(self):
return f"{DOWNLOAD_DIR}{self.uid}"
def processed_bytes(self):
- return self.obj.downloaded_bytes
+ if self.obj.downloaded_bytes != 0:
+ return self.obj.downloaded_bytes
+ else:
+ return get_path_size(f"{DOWNLOAD_DIR}{self.uid}")
def size_raw(self):
return self.obj.size
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index fefb171c2..88da6973d 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -23,7 +23,7 @@
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, SHORTENER, SHORTENER_API
from bot.helper.ext_utils.bot_utils import *
-from bot.helper.ext_utils.fs_utils import get_mime_type
+from bot.helper.ext_utils.fs_utils import get_mime_type, get_path_size
LOGGER = logging.getLogger(__name__)
logging.getLogger('googleapiclient.discovery').setLevel(logging.ERROR)
@@ -212,6 +212,7 @@ def upload(self, file_name: str):
self.__listener.onUploadStarted()
file_dir = f"{DOWNLOAD_DIR}{self.__listener.message.message_id}"
file_path = f"{file_dir}/{file_name}"
+ size = get_readable_file_size(get_path_size(file_path))
LOGGER.info("Uploading File: " + file_path)
self.start_time = time.time()
self.updater = setInterval(self.update_interval, self._on_upload_progress)
@@ -253,7 +254,7 @@ def upload(self, file_name: str):
finally:
self.updater.cancel()
LOGGER.info(download_dict)
- self.__listener.onUploadComplete(link)
+ self.__listener.onUploadComplete(link, size)
LOGGER.info("Deleting downloaded file/folder..")
return link
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index e93cd0c61..d53ae2ab4 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -94,10 +94,10 @@ def onDownloadComplete(self):
else:
path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
up_name = pathlib.PurePath(path).name
+ up_path = f'{DOWNLOAD_DIR}{self.uid}/{up_name}'
LOGGER.info(f"Upload Name : {up_name}")
drive = gdriveTools.GoogleDriveHelper(up_name, self)
- if size == 0:
- size = fs_utils.get_path_size(m_path)
+ size = fs_utils.get_path_size(up_path)
upload_status = UploadStatus(drive, size, self)
with download_dict_lock:
download_dict[self.uid] = upload_status
@@ -136,9 +136,9 @@ def onUploadStarted(self):
def onUploadProgress(self):
pass
- def onUploadComplete(self, link: str):
+ def onUploadComplete(self, link: str, size):
with download_dict_lock:
- msg = f'Filename : {download_dict[self.uid].name()}\nSize : {download_dict[self.uid].size()}'
+ msg = f'Filename : {download_dict[self.uid].name()}\nSize : {size}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
From 474e795d27d130d12f9510e0a6f08d63c395d3c1 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sat, 7 Nov 2020 15:52:03 +0530
Subject: [PATCH 051/190] Fix Typo
---
bot/helper/ext_utils/bot_utils.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 4cad22002..46f56a7a0 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -95,9 +95,12 @@ def get_readable_message():
msg += f"Filename : {download.name()}"
msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
- msg += f"\n{get_progress_bar_string(download)} {download.progress()}" \
- f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}" \
- f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
+ msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
+ if download.status() == MirrorStatus.DOWNLOADING:
+ msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ else:
+ msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
From a9acc687617ed1e72d2335dbe01cfa2e92ed099d Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sun, 8 Nov 2020 19:10:32 +0530
Subject: [PATCH 052/190] Fix Typo
---
bot/helper/ext_utils/bot_utils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 46f56a7a0..057e054fa 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -96,7 +96,7 @@ def get_readable_message():
msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
- if download.status() == MirrorStatus.DOWNLOADING:
+ if download.status() == MirrorStatus.STATUS_DOWNLOADING:
msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
From 497ed167e541117bc8ff8983be5bfdeadbc2ccd1 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Thu, 12 Nov 2020 21:34:05 +0530
Subject: [PATCH 053/190] =?UTF-8?q?Bye....=20(=E2=97=95=E2=80=BF=E2=97=95)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index f9822414f..37d937d54 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+# ! Development Stopped!
+I am offline on telegram too. So don't waste your time in messaging me on TG. Don't know when i will be back. B...Bye (◕‿◕)
+
# Important - Read these points first
- Original repo is https://github.com/lzzy12/python-aria-mirror-bot
- I have collected some cool features from various repositories and merged them in one.
From 51cf742d168f38db1e5eec6e5ddbadeed09946e4 Mon Sep 17 00:00:00 2001
From: Samir <64221555+SamirJanaOfficial@users.noreply.github.com>
Date: Sat, 2 Jan 2021 14:36:33 +0530
Subject: [PATCH 054/190] Fixed the missing module 'appdirs'
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index 26e53ab5c..1fe407f6e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,3 +14,4 @@ TgCrypto>=1.1.1,<1.1.10
git+https://gitlab.com/magneto261290/youtube-dl
lxml
telegraph
+appdirs
From d47c713bfd1934f239ac96bdacd98c0d5c7b9938 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Wed, 20 Jan 2021 14:42:06 +0530
Subject: [PATCH 055/190] updates soon....
---
README.md | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 37d937d54..c073bda2e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,3 @@
-# ! Development Stopped!
-I am offline on telegram too. So don't waste your time in messaging me on TG. Don't know when i will be back. B...Bye (◕‿◕)
-
# Important - Read these points first
- Original repo is https://github.com/lzzy12/python-aria-mirror-bot
- I have collected some cool features from various repositories and merged them in one.
@@ -8,6 +5,18 @@ I am offline on telegram too. So don't waste your time in messaging me on TG. Do
- This (or any custom) repo is not supported in official bot support group.
- So if you have any issue then check first that issue is in official repo or not, You are only allowed to report that issue in bot support group if that issue is also present in official repo.
+## Features Coming soon....
+- Custom Filename
+```
+Only for url, telegram files and ytdl.
+Not for mega links and magnet/torrents
+```
+- Rename Drive files
+
+Let's have some chit chat here - [@Magneto_chit_chat](https://t.me/magneto_chit_chat)
+Note :- it is not a Bot Support group. It's only for discussing rubbish things bcoz i want your help to learn coding 😜🤪.
+
+
## Credits :-
- First of all, full credit goes to [Shivam Jha aka lzzy12](https://github.com/lzzy12) He build up this bot from scratch.
- Then a huge thanks to [Sreeraj V R](https://github.com/SVR666) You can checkout his [repo here](https://github.com/SVR666/LoaderX-Bot)
@@ -25,6 +34,7 @@ I am offline on telegram too. So don't waste your time in messaging me on TG. Do
3. Fix SSL handsake error
```
+
# What is this repo about?
This is a telegram bot writen in python for mirroring files on the internet to our beloved Google Drive.
From 60b36146e00aeb60242eec26307e3e851f46b5c2 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Thu, 21 Jan 2021 02:54:35 +0530
Subject: [PATCH 056/190] Added Support for Custom FileName
---
README.md | 8 +++--
.../download_utils/aria2_download.py | 6 ++--
.../download_utils/telegram_downloader.py | 10 ++++--
.../youtube_dl_download_helper.py | 16 ++++++---
bot/modules/mirror.py | 13 ++++---
bot/modules/watch.py | 34 +++++++++++++------
6 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index c073bda2e..de3b7b85d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
- So if you have any issue then check first that issue is in official repo or not, You are only allowed to report that issue in bot support group if that issue is also present in official repo.
## Features Coming soon....
-- Custom Filename
+- ~Custom Filename~ Added
```
Only for url, telegram files and ytdl.
Not for mega links and magnet/torrents
@@ -18,7 +18,7 @@ Note :- it is not a Bot Support group. It's only for discussing rubbish things b
## Credits :-
-- First of all, full credit goes to [Shivam Jha aka lzzy12](https://github.com/lzzy12) He build up this bot from scratch.
+- First of all, full credit goes to [Shivam Jha aka lzzy12](https://github.com/lzzy12) and [JaskaranSM aka Zero Cool](https://github.com/jaskaranSM) They build up this bot from scratch.
- Then a huge thanks to [Sreeraj V R](https://github.com/SVR666) You can checkout his [repo here](https://github.com/SVR666/LoaderX-Bot)
- Features added from [Sreeraj V R's](https://github.com/SVR666) repo -
```
@@ -46,6 +46,7 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Mirroring Mega.nz links to google drive (In development stage)
- Mirror Telegram files to google drive
- Mirror all youtube-dl supported links
+- Custom filename support in direct link, telegram files, YT-DL links
- Extract these filetypes and uploads to google drive
> ZIP, RAR, TAR, 7z, ISO, WIM, CAB, GZIP, BZIP2,
> APM, ARJ, CHM, CPIO, CramFS, DEB, DMG, FAT,
@@ -61,6 +62,9 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Index Link support
- Shortener support
+- For using custom filename see these examples :-
+> https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20
+
## Bot commands to be set in botfather
```
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index 540b7258f..133c892be 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -79,11 +79,11 @@ def start_listener(self):
on_download_complete=self.__onDownloadComplete)
- def add_download(self, link: str, path,listener):
+ def add_download(self, link: str, path, listener, filename):
if is_magnet(link):
- download = aria2.add_magnet(link, {'dir': path})
+ download = aria2.add_magnet(link, {'dir': path, 'out': filename})
else:
- download = aria2.add_uris([link], {'dir': path})
+ download = aria2.add_uris([link], {'dir': path, 'out': filename})
if download.error_message: #no need to proceed further at this point
listener.onDownloadError(download.error_message)
return
diff --git a/bot/helper/mirror_utils/download_utils/telegram_downloader.py b/bot/helper/mirror_utils/download_utils/telegram_downloader.py
index b35f7f3dd..7b7b89b0e 100644
--- a/bot/helper/mirror_utils/download_utils/telegram_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/telegram_downloader.py
@@ -84,7 +84,7 @@ def __download(self, message, path):
if not self.__is_cancelled:
self.__onDownloadError('Internal error occurred')
- def add_download(self, message, path):
+ def add_download(self, message, path, filename):
_message = self.__user_bot.get_messages(message.chat.id, message.message_id)
media = None
media_array = [_message.document, _message.video, _message.audio]
@@ -96,9 +96,13 @@ def add_download(self, message, path):
with global_lock:
# For avoiding locking the thread lock for long time unnecessarily
download = media.file_id not in GLOBAL_GID
-
+ if filename == "":
+ name = media.file_name
+ else:
+ name = filename
+ path = path + name
if download:
- self.__onDownloadStart(media.file_name, media.file_size, media.file_id)
+ self.__onDownloadStart(name, media.file_size, media.file_id)
LOGGER.info(f'Downloading telegram file with id: {media.file_id}')
threading.Thread(target=self.__download, args=(_message, path)).start()
else:
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 57ee23a93..150c9142f 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -19,7 +19,10 @@ def debug(self, msg):
# Hack to fix changing changing extension
match = re.search(r'.ffmpeg..Merging formats into..(.*?).$', msg)
if match and not self.obj.is_playlist:
- self.obj.name = match.group(1)
+ newname = match.group(1)
+ newname = newname.split("/")
+ newname = newname[-1]
+ self.obj.name = newname
@staticmethod
def warning(msg):
@@ -94,14 +97,17 @@ def __onDownloadComplete(self):
def onDownloadError(self, error):
self.__listener.onDownloadError(error)
- def extractMetaData(self, link, qual):
+ def extractMetaData(self, link, qual, name):
if 'hotstar' or 'sonyliv' in link:
self.opts['geo_bypass_country'] = 'IN'
with YoutubeDL(self.opts) as ydl:
try:
result = ydl.extract_info(link, download=False)
- name = ydl.prepare_filename(result)
+ if name == "":
+ name = ydl.prepare_filename(result)
+ else:
+ name = name
# noobway hack for changing extension after converting to mp3
if qual == "audio":
name = name.replace(".mp4", ".mp3").replace(".webm", ".mp3")
@@ -140,9 +146,9 @@ def __download(self, link):
LOGGER.info("Download Cancelled by User!")
self.onDownloadError("Download Cancelled by User!")
- def add_download(self, link, path, qual):
+ def add_download(self, link, path, qual, name):
self.__onDownloadStart()
- self.extractMetaData(link, qual)
+ self.extractMetaData(link, qual, name)
LOGGER.info(f"Downloading with YT-DL: {link}")
self.__gid = f"{self.vid_id}{self.__listener.uid}"
if qual == "audio":
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index d53ae2ab4..c0142c21e 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -197,10 +197,15 @@ def onUploadError(self, error):
def _mirror(bot, update, isTar=False, extract=False):
message_args = update.message.text.split(' ')
+ name_args = update.message.text.split('|')
try:
link = message_args[1]
except IndexError:
link = ''
+ try:
+ name = name_args[1]
+ except IndexError:
+ name = ''
LOGGER.info(link)
link = link.strip()
reply_to = update.message.reply_to_message
@@ -213,12 +218,12 @@ def _mirror(bot, update, isTar=False, extract=False):
file = i
break
- if len(link) == 0:
+ if not bot_utils.is_url(link) and not bot_utils.is_magnet(link) or len(link) == 0:
if file is not None:
if file.mime_type != "application/x-bittorrent":
listener = MirrorListener(bot, update, isTar, tag)
tg_downloader = TelegramDownloadHelper(listener)
- tg_downloader.add_download(reply_to, f'{DOWNLOAD_DIR}{listener.uid}/')
+ tg_downloader.add_download(reply_to, f'{DOWNLOAD_DIR}{listener.uid}/', name)
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
@@ -241,10 +246,10 @@ def _mirror(bot, update, isTar=False, extract=False):
sendMessage("Mega links are blocked bcoz mega downloading is too much unstable and buggy. mega support will be added back after fix", bot, update)
else:
mega_dl = MegaDownloadHelper()
- mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
+ mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener, name)
sendStatusMessage(update, bot)
else:
- ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
+ ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener, name)
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index a2ec2d740..534b3ce7c 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -10,20 +10,36 @@
import threading
-def _watch(bot: Bot, update: Update, args: list, isTar=False):
+def _watch(bot: Bot, update, isTar=False):
+ mssg = update.message.text
+ message_args = mssg.split(' ')
+ name_args = mssg.split('|')
try:
- link = args[0]
+ link = message_args[1]
except IndexError:
- msg = f"/{BotCommands.WatchCommand} [yt_dl supported link] [quality] to mirror with youtube_dl.\n\n"
- msg += "Example of quality :- audio, 144, 360, 720, 1080.\nNote :- Quality is optional"
+ msg = f"/{BotCommands.WatchCommand} [yt_dl supported link] [quality] |[CustomName] to mirror with youtube_dl.\n\n"
+ msg += "Note :- Quality and custom name are optional\n\nExample of quality :- audio, 144, 240, 360, 480, 720, 1080, 2160."
+ msg += "\n\nIf you want to use custom filename, plz enter it after |"
+ msg += f"\n\nExample :-\n/{BotCommands.WatchCommand} https://youtu.be/ocX2FN1nguA 720 |My video bro\n\n"
+ msg += "This file will be downloaded in 720p quality and it's name will be My video bro"
sendMessage(msg, bot, update)
return
try:
- qual = args[1]
+ if "|" in mssg:
+ mssg = mssg.split("|")
+ qual = mssg[0].split(" ")[2]
+ if qual == "":
+ raise IndexError
+ else:
+ qual = message_args[2]
if qual != "audio":
qual = f'bestvideo[height<={qual}]+bestaudio/best[height<={qual}]'
except IndexError:
qual = "bestvideo+bestaudio/best"
+ try:
+ name = name_args[1]
+ except IndexError:
+ name = ""
reply_to = update.message.reply_to_message
if reply_to is not None:
tag = reply_to.from_user.username
@@ -32,7 +48,7 @@ def _watch(bot: Bot, update: Update, args: list, isTar=False):
listener = MirrorListener(bot, update, isTar, tag)
ydl = YoutubeDLHelper(listener)
- threading.Thread(target=ydl.add_download,args=(link, f'{DOWNLOAD_DIR}{listener.uid}', qual)).start()
+ threading.Thread(target=ydl.add_download,args=(link, f'{DOWNLOAD_DIR}{listener.uid}', qual, name)).start()
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
@@ -40,18 +56,16 @@ def _watch(bot: Bot, update: Update, args: list, isTar=False):
@run_async
def watchTar(update, context):
- _watch(context.bot, update, context.args, True)
+ _watch(context.bot, update, True)
def watch(update, context):
- _watch(context.bot, update, context.args)
+ _watch(context.bot, update)
mirror_handler = CommandHandler(BotCommands.WatchCommand, watch,
- pass_args=True,
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
tar_mirror_handler = CommandHandler(BotCommands.TarWatchCommand, watchTar,
- pass_args=True,
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
From c1806305cc033284f61b5b72f8d55db7456e0028 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Fri, 22 Jan 2021 19:13:55 +0530
Subject: [PATCH 057/190] Added: Extract Password Protected Archive Files
---
Dockerfile | 3 +-
README.md | 3 +-
bot/modules/mirror.py | 18 +++-
pextract | 195 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 213 insertions(+), 6 deletions(-)
create mode 100644 pextract
diff --git a/Dockerfile b/Dockerfile
index 4d8526461..1450df825 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,8 @@ RUN apt-get -qq update && \
COPY requirements.txt .
COPY extract /usr/local/bin
-RUN chmod +x /usr/local/bin/extract
+COPY pextract /usr/local/bin
+RUN chmod +x /usr/local/bin/extract && chmod +x /usr/local/bin/pextract
RUN pip3 install --no-cache-dir -r requirements.txt
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
diff --git a/README.md b/README.md
index de3b7b85d..e1720020d 100644
--- a/README.md
+++ b/README.md
@@ -61,8 +61,9 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Uploading To Team Drives.
- Index Link support
- Shortener support
+- Extract password protected files (It's not hack, you have to enter password for extracting. LOL)
-- For using custom filename see these examples :-
+- For extracting password protected files and using custom filename see these examples :-
> https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20
## Bot commands to be set in botfather
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index c0142c21e..8f09f626d 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -24,17 +24,19 @@
import os
import subprocess
import threading
+import re
ariaDlManager = AriaDownloadHelper()
ariaDlManager.start_listener()
class MirrorListener(listeners.MirrorListeners):
- def __init__(self, bot, update, isTar=False, tag=None, extract=False):
+ def __init__(self, bot, update, pswd, isTar=False, tag=None, extract=False):
super().__init__(bot, update)
self.isTar = isTar
self.tag = tag
self.extract = extract
+ self.pswd = pswd
def onDownloadStarted(self):
pass
@@ -77,7 +79,11 @@ def onDownloadComplete(self):
)
with download_dict_lock:
download_dict[self.uid] = ExtractStatus(name, m_path, size)
- archive_result = subprocess.run(["extract", m_path])
+ pswd = self.pswd
+ if pswd is not None:
+ archive_result = subprocess.run(["pextract", m_path, pswd])
+ else:
+ archive_result = subprocess.run(["extract", m_path])
if archive_result.returncode == 0:
threading.Thread(target=os.remove, args=(m_path,)).start()
LOGGER.info(f"Deleting archive : {m_path}")
@@ -206,6 +212,10 @@ def _mirror(bot, update, isTar=False, extract=False):
name = name_args[1]
except IndexError:
name = ''
+ pswd = re.search('(?<=pswd: )(.*)', update.message.text)
+ if pswd is not None:
+ pswd = pswd.groups()
+ pswd = " ".join(pswd)
LOGGER.info(link)
link = link.strip()
reply_to = update.message.reply_to_message
@@ -240,7 +250,7 @@ def _mirror(bot, update, isTar=False, extract=False):
link = direct_link_generator(link)
except DirectDownloadLinkException as e:
LOGGER.info(f'{link}: {e}')
- listener = MirrorListener(bot, update, isTar, tag, extract)
+ listener = MirrorListener(bot, update, pswd, isTar, tag, extract)
if bot_utils.is_mega_link(link):
if BLOCK_MEGA_LINKS:
sendMessage("Mega links are blocked bcoz mega downloading is too much unstable and buggy. mega support will be added back after fix", bot, update)
@@ -278,4 +288,4 @@ def unzip_mirror(update, context):
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
-dispatcher.add_handler(unzip_mirror_handler)
+dispatcher.add_handler(unzip_mirror_handler)
\ No newline at end of file
diff --git a/pextract b/pextract
new file mode 100644
index 000000000..297a0eafc
--- /dev/null
+++ b/pextract
@@ -0,0 +1,195 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $(basename $0) FILES"
+ exit 1
+fi
+
+extract() {
+ arg="$1"
+ pswd="$2"
+ cd "$(dirname "$arg")" || exit
+ case "$arg" in
+ *.tar.bz2)
+ tar xjf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.tar.gz)
+ tar xzf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.bz2)
+ bunzip2 "$arg"
+ local code=$?
+ ;;
+ *.gz)
+ gunzip "$arg"
+ local code=$?
+ ;;
+ *.tar)
+ tar xf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.tbz2)
+ (tar xjf "$arg" --one-top-level)
+ local code=$?
+ ;;
+ *.tgz)
+ tar xzf "$arg" --one-top-level
+ local code=$?
+ ;;
+ *.zip)
+ a_dir=$(expr "$arg" : '\(.*\).zip')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.7z)
+ a_dir=$(expr "$arg" : '\(.*\).7z')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.Z)
+ uncompress "$arg"
+ local code=$?
+ ;;
+ *.rar)
+ a_dir=$(expr "$arg" : '\(.*\).rar')
+ mkdir "$a_dir"
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.iso)
+ a_dir=$(expr "$arg" : '\(.*\).iso')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.wim)
+ a_dir=$(expr "$arg" : '\(.*\).wim')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.cab)
+ a_dir=$(expr "$arg" : '\(.*\).cab')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.apm)
+ a_dir=$(expr "$arg" : '\(.*\).apm')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.arj)
+ a_dir=$(expr "$arg" : '\(.*\).arj')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.chm)
+ a_dir=$(expr "$arg" : '\(.*\).chm')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.cpio)
+ a_dir=$(expr "$arg" : '\(.*\).cpio')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.cramfs)
+ a_dir=$(expr "$arg" : '\(.*\).cramfs')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.deb)
+ a_dir=$(expr "$arg" : '\(.*\).deb')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.dmg)
+ a_dir=$(expr "$arg" : '\(.*\).dmg')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.fat)
+ a_dir=$(expr "$arg" : '\(.*\).fat')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.hfs)
+ a_dir=$(expr "$arg" : '\(.*\).hfs')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.lzh)
+ a_dir=$(expr "$arg" : '\(.*\).lzh')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.lzma)
+ a_dir=$(expr "$arg" : '\(.*\).lzma')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.lzma2)
+ a_dir=$(expr "$arg" : '\(.*\).lzma2')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.mbr)
+ a_dir=$(expr "$arg" : '\(.*\).mbr')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.msi)
+ a_dir=$(expr "$arg" : '\(.*\).msi')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.mslz)
+ a_dir=$(expr "$arg" : '\(.*\).mslz')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.nsis)
+ a_dir=$(expr "$arg" : '\(.*\).nsis')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.ntfs)
+ a_dir=$(expr "$arg" : '\(.*\).ntfs')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.rpm)
+ a_dir=$(expr "$arg" : '\(.*\).rpm')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.squashfs)
+ a_dir=$(expr "$arg" : '\(.*\).squashfs')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.udf)
+ a_dir=$(expr "$arg" : '\(.*\).udf')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.vhd)
+ a_dir=$(expr "$arg" : '\(.*\).vhd')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *.xar)
+ a_dir=$(expr "$arg" : '\(.*\).xar')
+ 7z x "$arg" -o"$a_dir" -p"$pswd"
+ local code=$?
+ ;;
+ *)
+ echo "'$arg' cannot be extracted via extract()" 1>&2
+ exit 1
+ ;;
+ esac
+ cd - || exit $?
+ exit $code
+}
+
+extract "$1" "$2"
\ No newline at end of file
From 35428513b262e7cc38d2561545be975cf93822a0 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Fri, 22 Jan 2021 20:38:00 +0530
Subject: [PATCH 058/190] Some fixup in STOP_DUPLICATE_MIRROR
---
.../download_utils/aria2_download.py | 21 +++++++++++--------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index 133c892be..d548fc0e1 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -22,17 +22,20 @@ def __onDownloadStarted(self, api, gid):
download = api.get_download(gid)
self.name = download.name
sname = download.name
- gdrive = GoogleDriveHelper(None)
- smsg, button = gdrive.drive_list(sname)
if STOP_DUPLICATE_MIRROR:
- if smsg:
- dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
- print(dl.getListener())
- sendMarkup(" Here are the search results:👇👇", dl.getListener().bot, dl.getListener().update, button)
- aria2.remove([download])
- return
+ if dl.getListener().isTar == True:
+ sname = sname + ".tar"
+ if dl.getListener().extract == True:
+ smsg = None
+ else:
+ gdrive = GoogleDriveHelper(None)
+ smsg, button = gdrive.drive_list(sname)
+ if smsg:
+ dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
+ sendMarkup(" Here are the search results:👇👇", dl.getListener().bot, dl.getListener().update, button)
+ aria2.remove([download])
+ return
update_all_messages()
-
def __onDownloadComplete(self, api: API, gid):
LOGGER.info(f"onDownloadComplete: {gid}")
dl = getDownloadByGid(gid)
From ee6f61f90d8ceef3f3f833b1e76239f6531bacc6 Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sat, 23 Jan 2021 19:20:59 +0530
Subject: [PATCH 059/190] Fix Telegram file tar and unzipmirror issue.
---
bot/modules/mirror.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 8f09f626d..30b05ad4a 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -231,7 +231,7 @@ def _mirror(bot, update, isTar=False, extract=False):
if not bot_utils.is_url(link) and not bot_utils.is_magnet(link) or len(link) == 0:
if file is not None:
if file.mime_type != "application/x-bittorrent":
- listener = MirrorListener(bot, update, isTar, tag)
+ listener = MirrorListener(bot, update, pswd, isTar, tag, extract)
tg_downloader = TelegramDownloadHelper(listener)
tg_downloader.add_download(reply_to, f'{DOWNLOAD_DIR}{listener.uid}/', name)
sendStatusMessage(update, bot)
@@ -288,4 +288,4 @@ def unzip_mirror(update, context):
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
-dispatcher.add_handler(unzip_mirror_handler)
\ No newline at end of file
+dispatcher.add_handler(unzip_mirror_handler)
From 89b39f47157eb69bffb1ee48a28f75060e95dd32 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Thu, 28 Jan 2021 12:27:38 +0530
Subject: [PATCH 060/190] Many minor bug fixes
---
.../download_utils/youtube_dl_download_helper.py | 8 ++++++--
.../mirror_utils/status_utils/mega_download_status.py | 1 +
.../status_utils/youtube_dl_download_status.py | 2 +-
bot/modules/mirror.py | 7 ++++++-
bot/modules/watch.py | 4 ++--
5 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 150c9142f..3fc6507aa 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -74,10 +74,14 @@ def __onDownloadProgress(self, d):
elif d['status'] == "downloading":
with self.__resource_lock:
self.__download_speed = d['speed']
+ try:
+ tbyte = d['total_bytes']
+ except KeyError:
+ tbyte = d['total_bytes_estimate']
if self.is_playlist:
- progress = d['downloaded_bytes'] / d['total_bytes']
+ progress = d['downloaded_bytes'] / tbyte
chunk_size = d['downloaded_bytes'] - self.last_downloaded
- self.last_downloaded = d['total_bytes'] * progress
+ self.last_downloaded = tbyte * progress
self.downloaded_bytes += chunk_size
try:
self.progress = (self.downloaded_bytes / self.size) * 100
diff --git a/bot/helper/mirror_utils/status_utils/mega_download_status.py b/bot/helper/mirror_utils/status_utils/mega_download_status.py
index cc7f7b435..33c27a31f 100644
--- a/bot/helper/mirror_utils/status_utils/mega_download_status.py
+++ b/bot/helper/mirror_utils/status_utils/mega_download_status.py
@@ -9,6 +9,7 @@ def __init__(self, obj, listener):
self.uid = obj.uid
self.listener = listener
self.obj = obj
+ self.message = listener.message
def name(self) -> str:
return self.obj.name
diff --git a/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py b/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
index 089068ca0..3950baddd 100644
--- a/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
+++ b/bot/helper/mirror_utils/status_utils/youtube_dl_download_status.py
@@ -52,7 +52,7 @@ def eta(self):
try:
seconds = (self.size_raw() - self.processed_bytes()) / self.speed_raw()
return f'{get_readable_time(seconds)}'
- except ZeroDivisionError:
+ except:
return '-'
def download(self):
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 30b05ad4a..6fdc5bcfe 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -206,10 +206,15 @@ def _mirror(bot, update, isTar=False, extract=False):
name_args = update.message.text.split('|')
try:
link = message_args[1]
+ if link.startswith("|") or link.startswith("pswd: "):
+ link = ''
except IndexError:
link = ''
try:
name = name_args[1]
+ name = name.strip()
+ if name.startswith("pswd: "):
+ name = ''
except IndexError:
name = ''
pswd = re.search('(?<=pswd: )(.*)', update.message.text)
@@ -256,7 +261,7 @@ def _mirror(bot, update, isTar=False, extract=False):
sendMessage("Mega links are blocked bcoz mega downloading is too much unstable and buggy. mega support will be added back after fix", bot, update)
else:
mega_dl = MegaDownloadHelper()
- mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener, name)
+ mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
sendStatusMessage(update, bot)
else:
ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener, name)
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index 534b3ce7c..f869c1ba9 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -45,8 +45,8 @@ def _watch(bot: Bot, update, isTar=False):
tag = reply_to.from_user.username
else:
tag = None
-
- listener = MirrorListener(bot, update, isTar, tag)
+ pswd = ""
+ listener = MirrorListener(bot, update, pswd, isTar, tag)
ydl = YoutubeDLHelper(listener)
threading.Thread(target=ydl.add_download,args=(link, f'{DOWNLOAD_DIR}{listener.uid}', qual, name)).start()
sendStatusMessage(update, bot)
From 8e6b60051c97652cff8709af208cdc5389cd1eee Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Thu, 28 Jan 2021 17:46:25 +0530
Subject: [PATCH 061/190] Added AUTHORIZED_CHATS in config (env. variables)
---
bot/__init__.py | 8 ++++++++
config_sample.env | 1 +
2 files changed, 9 insertions(+)
diff --git a/bot/__init__.py b/bot/__init__.py
index f29b94ec3..db72db78a 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -66,6 +66,14 @@ def getConfig(name: str):
for line in lines:
# LOGGER.info(line.split())
AUTHORIZED_CHATS.add(int(line.split()[0]))
+try:
+ achats = getConfig('AUTHORIZED_CHATS')
+ achats = achats.split(" ")
+ for chats in achats:
+ AUTHORIZED_CHATS.add(int(chats))
+except:
+ pass
+
try:
BOT_TOKEN = getConfig('BOT_TOKEN')
parent_id = getConfig('GDRIVE_FOLDER_ID')
diff --git a/config_sample.env b/config_sample.env
index 56c7dda9a..d4b1b7916 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -15,6 +15,7 @@ TELEGRAM_API =
TELEGRAM_HASH = ""
USE_SERVICE_ACCOUNTS = ""
# Optional config
+AUTHORIZED_CHATS = "" #Separated by space
INDEX_URL = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
From 88e1f12d2842e5cd6329dc835f2c2774ff27b69d Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 10:56:24 +0530
Subject: [PATCH 062/190] Update bot_utils.py
---
bot/helper/ext_utils/bot_utils.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 057e054fa..bb7c6ebdf 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -23,7 +23,7 @@ class MirrorStatus:
PROGRESS_MAX_SIZE = 100 // 8
-PROGRESS_INCOMPLETE = ['●', '●', '●', '●', '●', '●', '●']
+PROGRESS_INCOMPLETE = ['▓', '▓', '▓', '▓', '▓', '▓', '▓']
SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
@@ -80,10 +80,10 @@ def get_progress_bar_string(status):
p = min(max(p, 0), 100)
cFull = p // 8
cPart = p % 8 - 1
- p_str = '●' * cFull
+ p_str = '▓' * cFull
if cPart >= 0:
p_str += PROGRESS_INCOMPLETE[cPart]
- p_str += '○' * (PROGRESS_MAX_SIZE - cFull)
+ p_str += '░' * (PROGRESS_MAX_SIZE - cFull)
p_str = f"[{p_str}]"
return p_str
From 0645a231869a98b1235e873ce1ab6cbaf5ded82a Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:01:11 +0530
Subject: [PATCH 063/190] Update message_utils.py
---
bot/helper/telegram_helper/message_utils.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index f2316c693..2375af932 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -73,9 +73,9 @@ def delete_all_messages():
def update_all_messages():
msg = get_readable_message()
- msg += f"CPU: {psutil.cpu_percent()}%" \
- f" DISK: {psutil.disk_usage('/').percent}%" \
- f" RAM: {psutil.virtual_memory().percent}%"
+ msg += f"🖥️CPU: {psutil.cpu_percent()}%" \
+ f" 📀DISK: {psutil.disk_usage('/').percent}%" \
+ f" 📝RAM: {psutil.virtual_memory().percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@@ -93,7 +93,7 @@ def update_all_messages():
uldl_bytes += float(speedy.split('M')[0]) * 1048576
dlspeed = get_readable_file_size(dlspeed_bytes)
ulspeed = get_readable_file_size(uldl_bytes)
- msg += f"\nDL:{dlspeed}ps 🔻| UL:{ulspeed}ps 🔺\n"
+ msg += f"\nDL:{dlspeed}ps ⏬| UL:{ulspeed}ps ⏫\n"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -108,9 +108,9 @@ def update_all_messages():
def sendStatusMessage(msg, bot):
progress = get_readable_message()
- progress += f"CPU: {psutil.cpu_percent()}%" \
- f" DISK: {psutil.disk_usage('/').percent}%" \
- f" RAM: {psutil.virtual_memory().percent}%"
+ progress += f"💻CPU: {psutil.cpu_percent()}%" \
+ f" 💽DISK: {psutil.disk_usage('/').percent}%" \
+ f" 📝RAM: {psutil.virtual_memory().percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
From b5698744360e4825b6e17eb9f21ffbde00c46292 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:14:06 +0530
Subject: [PATCH 064/190] Update mirror.py
---
bot/modules/mirror.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 6fdc5bcfe..71e4be952 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -148,9 +148,9 @@ def onUploadComplete(self, link: str, size):
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
- buttons.buildbutton("⚡Drive Link⚡", surl)
+ buttons.buildbutton("💾Drive Link💾", surl)
else:
- buttons.buildbutton("⚡Drive Link⚡", link)
+ buttons.buildbutton("💾Drive Link💾", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}')
@@ -158,9 +158,9 @@ def onUploadComplete(self, link: str, size):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
- buttons.buildbutton("💥Index Link💥", siurl)
+ buttons.buildbutton("🚀Index Link🚀", siurl)
else:
- buttons.buildbutton("💥Index Link💥", share_url)
+ buttons.buildbutton("🚀Index Link🚀", share_url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
From 33e8ca1bad2a65371fc351ffdb386a8e3b037fd6 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:15:18 +0530
Subject: [PATCH 065/190] Update __main__.py
---
bot/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 1a9352d41..9681f5192 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -32,7 +32,7 @@ def stats(update, context):
f'Total disk space: {total}\n' \
f'Used: {used} ' \
f'Free: {free}\n\n' \
- f'📊Data Usage📊\nUpload: {sent}\n' \
+ f'📇Data Usage📇\nUpload: {sent}\n' \
f'Down: {recv}\n\n' \
f'CPU: {cpuUsage}% ' \
f'RAM: {memory}% ' \
From 325e9fd6c021c618cbf38a1cf6025244a3308965 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:21:26 +0530
Subject: [PATCH 066/190] Rename config_sample.env to config.env
---
config_sample.env => config.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename config_sample.env => config.env (97%)
diff --git a/config_sample.env b/config.env
similarity index 97%
rename from config_sample.env
rename to config.env
index d4b1b7916..48d04c459 100644
--- a/config_sample.env
+++ b/config.env
@@ -31,4 +31,4 @@ BUTTON_THREE_URL = ""
BUTTON_FOUR_NAME = ""
BUTTON_FOUR_URL = ""
BUTTON_FIVE_NAME = ""
-BUTTON_FIVE_URL = ""
\ No newline at end of file
+BUTTON_FIVE_URL = ""
From 80ae1622f1dc2728b51f5877ff164edff69302e0 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:21:41 +0530
Subject: [PATCH 067/190] Update config.env
---
config.env | 4 ----
1 file changed, 4 deletions(-)
diff --git a/config.env b/config.env
index 48d04c459..53213a987 100644
--- a/config.env
+++ b/config.env
@@ -1,7 +1,3 @@
-#Remove this line before deploying
-_____REMOVE_THIS_LINE_____=True
-
-# ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
BOT_TOKEN = ""
GDRIVE_FOLDER_ID = ""
TELEGRAPH_TOKEN = ""
From 6aa93997c3c315df1c1d1da7e439a2e4cbfa2945 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:21:56 +0530
Subject: [PATCH 068/190] Update config.env
---
config.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config.env b/config.env
index 53213a987..95a3f621f 100644
--- a/config.env
+++ b/config.env
@@ -2,7 +2,7 @@ BOT_TOKEN = ""
GDRIVE_FOLDER_ID = ""
TELEGRAPH_TOKEN = ""
OWNER_ID =
-DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
+DOWNLOAD_DIR = "/bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = ""
From 2982833df92b451e1a8d70704a9f3f12555c20cf Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:22:29 +0530
Subject: [PATCH 069/190] Update config.env
---
config.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config.env b/config.env
index 95a3f621f..6d9044f55 100644
--- a/config.env
+++ b/config.env
@@ -5,7 +5,7 @@ OWNER_ID =
DOWNLOAD_DIR = "/bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
-IS_TEAM_DRIVE = ""
+IS_TEAM_DRIVE = "True"
USER_SESSION_STRING = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
From a018382f76810f3d779be1dcb71b18f85929ebfe Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 30 Jan 2021 11:24:36 +0530
Subject: [PATCH 070/190] Update aria.sh
---
aria.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/aria.sh b/aria.sh
index d0cb89126..267ee7779 100755
--- a/aria.sh
+++ b/aria.sh
@@ -1,9 +1,10 @@
export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
-export MAX_CONCURRENT_DOWNLOADS=4
+export MAX_CONCURRENT_DOWNLOADS=10
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
--max-connection-per-server=10 --rpc-max-request-size=1024M \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
- --max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS
\ No newline at end of file
+ --max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
+ --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 \
From 2adccbea329f60b4d4e9cb6ec54d611f1eae439d Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Wed, 3 Feb 2021 19:03:43 +0530
Subject: [PATCH 071/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 267ee7779..31b6019a0 100755
--- a/aria.sh
+++ b/aria.sh
@@ -1,6 +1,6 @@
export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
-export MAX_CONCURRENT_DOWNLOADS=10
+export MAX_CONCURRENT_DOWNLOADS=7
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
--max-connection-per-server=10 --rpc-max-request-size=1024M \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
From 1b36b5de5fe2d5966f14a04b904fc1cc04835e57 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Wed, 3 Feb 2021 19:05:06 +0530
Subject: [PATCH 072/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 31b6019a0..32ec088e5 100755
--- a/aria.sh
+++ b/aria.sh
@@ -2,7 +2,7 @@ export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
export MAX_CONCURRENT_DOWNLOADS=7
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
- --max-connection-per-server=10 --rpc-max-request-size=1024M \
+ --max-connection-per-server=10 --rpc-max-request-size=1024M --bt-stop-timeout=600 \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
From 8c8607c45e395c979404650d59a8e6c99ec5db2d Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Wed, 10 Feb 2021 21:23:55 +0530
Subject: [PATCH 073/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 32ec088e5..4728c0da7 100755
--- a/aria.sh
+++ b/aria.sh
@@ -7,4 +7,4 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
- --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 \
+ --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 peer-agent=Transmission/2.77 \
From 1545e8761c586437762e0aa68c31052f6e115b16 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 13 Feb 2021 22:46:03 +0530
Subject: [PATCH 074/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 4728c0da7..964ce44c6 100755
--- a/aria.sh
+++ b/aria.sh
@@ -7,4 +7,4 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
- --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 peer-agent=Transmission/2.77 \
+ --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
From 54145f30efdd9f27a50dc33088ffb50e4ea0cafd Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 13 Feb 2021 22:46:18 +0530
Subject: [PATCH 075/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 964ce44c6..8b4efee70 100755
--- a/aria.sh
+++ b/aria.sh
@@ -1,6 +1,6 @@
export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
-export MAX_CONCURRENT_DOWNLOADS=7
+export MAX_CONCURRENT_DOWNLOADS=10
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
--max-connection-per-server=10 --rpc-max-request-size=1024M --bt-stop-timeout=600 \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
From ab75003d40470c22b0e922ba965722cfba58d736 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 13 Feb 2021 22:46:44 +0530
Subject: [PATCH 076/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index 8b4efee70..434ddf9b5 100755
--- a/aria.sh
+++ b/aria.sh
@@ -2,7 +2,7 @@ export MAX_DOWNLOAD_SPEED=0
tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
export MAX_CONCURRENT_DOWNLOADS=10
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
- --max-connection-per-server=10 --rpc-max-request-size=1024M --bt-stop-timeout=600 \
+ --max-connection-per-server=16 --rpc-max-request-size=1024M --bt-stop-timeout=600 \
--bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
--follow-torrent=mem --split=10 \
--daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
From d814bbf3f3e0b32d398483ae08210ef2d440a17c Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sun, 14 Feb 2021 01:34:21 +0530
Subject: [PATCH 077/190] Auto generate String Session and Telegraph Token
---
README.md | 8 --------
bot/__init__.py | 15 +++++++++++++--
config_sample.env | 2 --
generate_string_session.py | 6 ------
generate_telegraph_token.py | 6 ------
5 files changed, 13 insertions(+), 24 deletions(-)
delete mode 100644 generate_string_session.py
delete mode 100644 generate_telegraph_token.py
diff --git a/README.md b/README.md
index e1720020d..6112a0524 100644
--- a/README.md
+++ b/README.md
@@ -117,10 +117,6 @@ _____REMOVE_THIS_LINE_____=True
Fill up rest of the fields. Meaning of each fields are discussed below:
- **BOT_TOKEN** : The telegram bot token that you get from @BotFather
- **GDRIVE_FOLDER_ID** : This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.
-- **TELEGRAPH_TOKEN** : Telegraph token generated by running :
-```
-python3 generate_telegraph_token.py
-```
- **DOWNLOAD_DIR** : The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD_STATUS_UPDATE_INTERVAL** : A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it 5 seconds at least)
- **OWNER_ID** : The Telegram user ID (not username) of the owner of the bot
@@ -130,10 +126,6 @@ python3 generate_telegraph_token.py
- **INDEX_URL** : (Optional field) Refer to https://github.com/maple3142/GDIndex/ The URL should not have any trailing '/'
- **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
-- **USER_SESSION_STRING** : Generate String session by [clicking here](https://generatestringsession.magneto261290.repl.run/) **OR** you can generate by running :
-```
-python3 generate_string_session.py
-```
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
- **MEGA_PASSWORD**: Your password for your mega.nz account
diff --git a/bot/__init__.py b/bot/__init__.py
index db72db78a..a2c6f5f0b 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -6,6 +6,9 @@
import aria2p
import telegram.ext as tg
from dotenv import load_dotenv
+from pyrogram import Client
+from telegraph import Telegraph
+
import socket
import faulthandler
faulthandler.enable()
@@ -77,20 +80,28 @@ def getConfig(name: str):
try:
BOT_TOKEN = getConfig('BOT_TOKEN')
parent_id = getConfig('GDRIVE_FOLDER_ID')
- telegraph_token = getConfig('TELEGRAPH_TOKEN')
DOWNLOAD_DIR = getConfig('DOWNLOAD_DIR')
if DOWNLOAD_DIR[-1] != '/' or DOWNLOAD_DIR[-1] != '\\':
DOWNLOAD_DIR = DOWNLOAD_DIR + '/'
DOWNLOAD_STATUS_UPDATE_INTERVAL = int(getConfig('DOWNLOAD_STATUS_UPDATE_INTERVAL'))
OWNER_ID = int(getConfig('OWNER_ID'))
AUTO_DELETE_MESSAGE_DURATION = int(getConfig('AUTO_DELETE_MESSAGE_DURATION'))
- USER_SESSION_STRING = getConfig('USER_SESSION_STRING')
TELEGRAM_API = getConfig('TELEGRAM_API')
TELEGRAM_HASH = getConfig('TELEGRAM_HASH')
except KeyError as e:
LOGGER.error("One or more env variables missing! Exiting now")
exit(1)
+LOGGER.info("Generating USER_SESSION_STRING")
+with Client(':memory:', api_id=int(TELEGRAM_API), api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN) as app:
+ USER_SESSION_STRING = app.export_session_string()
+
+#Generate Telegraph Token
+LOGGER.info("Generating Telegraph Token")
+telegraph = Telegraph()
+telegraph.create_account(short_name="mirror_bot")
+telegraph_token = telegraph.get_access_token()
+
try:
MEGA_API_KEY = getConfig('MEGA_API_KEY')
except KeyError:
diff --git a/config_sample.env b/config_sample.env
index d4b1b7916..c0fb52677 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -4,13 +4,11 @@ _____REMOVE_THIS_LINE_____=True
# ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
BOT_TOKEN = ""
GDRIVE_FOLDER_ID = ""
-TELEGRAPH_TOKEN = ""
OWNER_ID =
DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = ""
-USER_SESSION_STRING = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
USE_SERVICE_ACCOUNTS = ""
diff --git a/generate_string_session.py b/generate_string_session.py
deleted file mode 100644
index fd6d57c55..000000000
--- a/generate_string_session.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from pyrogram import Client
-
-API_KEY = int(input("Enter API KEY: "))
-API_HASH = input("Enter API HASH: ")
-with Client(':memory:', api_id=API_KEY, api_hash=API_HASH) as app:
- print(app.export_session_string())
\ No newline at end of file
diff --git a/generate_telegraph_token.py b/generate_telegraph_token.py
deleted file mode 100644
index ad44e3e40..000000000
--- a/generate_telegraph_token.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from telegraph import Telegraph
-
-telegraph = Telegraph()
-telegraph.create_account(short_name=input("Enter a username for your Telegra.ph : "))
-
-print(f"Your Telegra.ph token ==> {telegraph.get_access_token()}")
\ No newline at end of file
From 6de66ea7974f3b177cb4e7a2982f6096bb072b6e Mon Sep 17 00:00:00 2001
From: Dev Singh Rajput
Date: Sun, 14 Feb 2021 01:39:43 +0530
Subject: [PATCH 078/190] Fix restart if user has not mirrored anything
---
bot/helper/ext_utils/fs_utils.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bot/helper/ext_utils/fs_utils.py b/bot/helper/ext_utils/fs_utils.py
index c73429dcc..52c10c385 100644
--- a/bot/helper/ext_utils/fs_utils.py
+++ b/bot/helper/ext_utils/fs_utils.py
@@ -23,7 +23,10 @@ def start_cleanup():
def clean_all():
aria2.remove_all(True)
- shutil.rmtree(DOWNLOAD_DIR)
+ try:
+ shutil.rmtree(DOWNLOAD_DIR)
+ except FileNotFoundError:
+ pass
def exit_clean_up(signal, frame):
From 98be7811401e23ca13351d34d43300af5a3e4c76 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 14 Feb 2021 12:34:46 +0530
Subject: [PATCH 079/190] Delete aria.sh
---
aria.sh | 10 ----------
1 file changed, 10 deletions(-)
delete mode 100755 aria.sh
diff --git a/aria.sh b/aria.sh
deleted file mode 100755
index 434ddf9b5..000000000
--- a/aria.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-export MAX_DOWNLOAD_SPEED=0
-tracker_list=$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt | awk '$1' | tr '\n' ',')
-export MAX_CONCURRENT_DOWNLOADS=10
-aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
- --max-connection-per-server=16 --rpc-max-request-size=1024M --bt-stop-timeout=600 \
- --bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
- --follow-torrent=mem --split=10 \
- --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
- --max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
- --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
From 309fc4c68ddc90bc67cccd2531b1524607e04769 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 14 Feb 2021 12:35:53 +0530
Subject: [PATCH 080/190] Add files via upload
---
aria.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 aria.sh
diff --git a/aria.sh b/aria.sh
new file mode 100644
index 000000000..e58b329dc
--- /dev/null
+++ b/aria.sh
@@ -0,0 +1,19 @@
+file="trackers.txt"
+echo "$(curl -Ns https://trackerslist.com/best_aria2.txt | awk '$1' | tr ',' '\n')" > trackers.txt
+echo "$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt)" >> trackers.txt
+tmp=$(sort trackers.txt | uniq) && echo "$tmp" > trackers.txt
+sed -i '/^$/d' trackers.txt
+sed -z -i 's/\n/,/g' trackers.txt
+tracker_list=$(cat trackers.txt)
+if [ -f $file ] ; then
+ rm $file
+fi
+tracker="[$tracker_list]"
+export MAX_DOWNLOAD_SPEED=0
+export MAX_CONCURRENT_DOWNLOADS=3
+aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 \
+ --max-connection-per-server=16 --rpc-max-request-size=1024M \
+ --seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 \
+ --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED --bt-stop-timeout=600 \
+ --max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
+ --bt-tracker=$tracker --bt-max-peers=0 --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
From fe5622e6eec8bfc7459bb3ffe644dd4b773eeab6 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 14 Feb 2021 12:36:28 +0530
Subject: [PATCH 081/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index e58b329dc..c21c2f2d2 100644
--- a/aria.sh
+++ b/aria.sh
@@ -10,7 +10,7 @@ if [ -f $file ] ; then
fi
tracker="[$tracker_list]"
export MAX_DOWNLOAD_SPEED=0
-export MAX_CONCURRENT_DOWNLOADS=3
+export MAX_CONCURRENT_DOWNLOADS=7
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 \
--max-connection-per-server=16 --rpc-max-request-size=1024M \
--seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 \
From c830666a00e03dd01621a24f343a41b498c98393 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sun, 14 Feb 2021 18:37:04 +0530
Subject: [PATCH 082/190] Random name while generating Telegraph Token
---
bot/__init__.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bot/__init__.py b/bot/__init__.py
index a2c6f5f0b..a7881ae80 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -2,6 +2,8 @@
import os
import threading
import time
+import random
+import string
import aria2p
import telegram.ext as tg
@@ -97,10 +99,12 @@ def getConfig(name: str):
USER_SESSION_STRING = app.export_session_string()
#Generate Telegraph Token
-LOGGER.info("Generating Telegraph Token")
+sname = ''.join(random.SystemRandom().choices(string.ascii_letters, k=8))
+LOGGER.info("Generating Telegraph Token using '" + sname + "' name")
telegraph = Telegraph()
-telegraph.create_account(short_name="mirror_bot")
+telegraph.create_account(short_name=sname)
telegraph_token = telegraph.get_access_token()
+LOGGER.info("Telegraph Token Generated: '" + telegraph_token + "'")
try:
MEGA_API_KEY = getConfig('MEGA_API_KEY')
From 89db5bc36e1c72cf505b8ec81b37732906640249 Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sun, 14 Feb 2021 18:38:41 +0530
Subject: [PATCH 083/190] Fix None FileName in mirroring some TG File
---
bot/modules/mirror.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 6fdc5bcfe..a5b6199ec 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -100,6 +100,8 @@ def onDownloadComplete(self):
else:
path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
up_name = pathlib.PurePath(path).name
+ if up_name == "None":
+ up_name = "".join(os.listdir(f'{DOWNLOAD_DIR}{self.uid}/'))
up_path = f'{DOWNLOAD_DIR}{self.uid}/{up_name}'
LOGGER.info(f"Upload Name : {up_name}")
drive = gdriveTools.GoogleDriveHelper(up_name, self)
From 1789c4736ac4567b747d176b6b01af747f5f673a Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:36:50 +0530
Subject: [PATCH 084/190] Update __main__.py
---
bot/__main__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 9681f5192..fc7c2ab35 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -13,7 +13,7 @@
from bot.helper.telegram_helper.message_utils import *
from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time
from .helper.telegram_helper.filters import CustomFilters
-from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete
+from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest
@run_async
@@ -99,6 +99,8 @@ def bot_help(update, context):
/{BotCommands.LogCommand}: Get a log file of the bot. Handy for getting crash reports
+/{BotCommands.SpeedCommand} : Check Internet Speed Of The Host
+
'''
sendMessage(help_string, context.bot, update)
From 24559f09a8b81c67eb2f5d73f439d33f31344753 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:38:43 +0530
Subject: [PATCH 085/190] adding speed check command
---
bot/helper/telegram_helper/bot_commands.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py
index c0d2cf401..7453edb53 100644
--- a/bot/helper/telegram_helper/bot_commands.py
+++ b/bot/helper/telegram_helper/bot_commands.py
@@ -7,6 +7,7 @@ def __init__(self):
self.CancelMirror = 'cancel'
self.CancelAllCommand = 'cancelall'
self.ListCommand = 'list'
+ self.SpeedCommand = 'speed'
self.StatusCommand = 'status'
self.AuthorizeCommand = 'authorize'
self.UnAuthorizeCommand = 'unauthorize'
From 7efa71390bd725771e56c4e564d96d4b0786aaf2 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:41:04 +0530
Subject: [PATCH 086/190] added speedtest script
---
bot/modules/speedtest.py | 47 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 bot/modules/speedtest.py
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
new file mode 100644
index 000000000..24a5aa3d3
--- /dev/null
+++ b/bot/modules/speedtest.py
@@ -0,0 +1,47 @@
+import speedtest
+
+from bot.helper.telegram_helper.filters import CustomFilters
+from bot import dispatcher, AUTHORIZED_CHATS
+from bot.helper.telegram_helper.bot_commands import BotCommands
+from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
+from telegram.ext import CallbackContext, Filters, run_async, CommandHandler
+
+
+@run_async
+def speedtst(update, context):
+ message = update.effective_message
+ ed_msg = message.reply_text("Running Speed Test . . . 💨")
+ test = speedtest.Speedtest()
+ test.get_best_server()
+ test.download()
+ test.upload()
+ test.results.share()
+ result = test.results.dict()
+ context.bot.editMessageText(
+ "🔻 Download Speed : "
+ f"{speed_convert(result['download'])}\n"
+ "🔺 Upload Speed : "
+ f"{speed_convert(result['upload'])}\n"
+ "📶 Ping : "
+ f"{result['ping']}\n"
+ "🏬 ISP : "
+ f"{result['client']['isp']}",
+ update.effective_chat.id,
+ ed_msg.message_id,
+ )
+
+def speed_convert(size):
+ """Hi human, you can't read bytes?"""
+ power = 2 ** 10
+ zero = 0
+ units = {0: "", 1: "Kb/s", 2: "Mb/s", 3: "Gb/s", 4: "Tb/s"}
+ while size > power:
+ size /= power
+ zero += 1
+ return f"{round(size, 2)} {units[zero]}"
+
+
+SPEED_HANDLER = CommandHandler(BotCommands.SpeedCommand, speedtst,
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+
+dispatcher.add_handler(SPEED_HANDLER)
From 19bfe48b61555d5575f884118b379a6fe45e83e0 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:42:11 +0530
Subject: [PATCH 087/190] added requiremets for speedtest
---
requirements.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/requirements.txt b/requirements.txt
index 1fe407f6e..1f3772181 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,3 +15,5 @@ git+https://gitlab.com/magneto261290/youtube-dl
lxml
telegraph
appdirs
+speedtest-cli
+messages
From e57b6bb4c9685c3405b43229440d61cba1bc1733 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:44:47 +0530
Subject: [PATCH 088/190] Create config_sample.env
---
config_sample.env | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 config_sample.env
diff --git a/config_sample.env b/config_sample.env
new file mode 100644
index 000000000..8be9fa649
--- /dev/null
+++ b/config_sample.env
@@ -0,0 +1,32 @@
+#Remove this line before deploying
+_____REMOVE_THIS_LINE_____=True
+
+# ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
+BOT_TOKEN = ""
+GDRIVE_FOLDER_ID = ""
+OWNER_ID =
+DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
+DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
+AUTO_DELETE_MESSAGE_DURATION = 20
+IS_TEAM_DRIVE = ""
+TELEGRAM_API =
+TELEGRAM_HASH = ""
+USE_SERVICE_ACCOUNTS = ""
+# Optional config
+AUTHORIZED_CHATS = "" #Separated by space
+INDEX_URL = ""
+MEGA_API_KEY = ""
+MEGA_EMAIL_ID = ""
+MEGA_PASSWORD = ""
+STOP_DUPLICATE_MIRROR = ""
+BLOCK_MEGA_LINKS = ""
+SHORTENER = ""
+SHORTENER_API = ""
+# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
+# If you don't know what are below entries, simply leave them, Don't fill anything in them.
+BUTTON_THREE_NAME = ""
+BUTTON_THREE_URL = ""
+BUTTON_FOUR_NAME = ""
+BUTTON_FOUR_URL = ""
+BUTTON_FIVE_NAME = ""
+BUTTON_FIVE_URL = ""
From fa419142bcbaaeba8c71b6c1e9f6066df0086bfb Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:52:14 +0530
Subject: [PATCH 089/190] update to restart command
now the userid added in the authorized chats can also restart bot , it is realy helpful for groups where admins is afk alot of the time,
keep in mind that not everybody from the authorized grp can restart, only the specifically mentioned person by their userid in the authorized chats will have this permission..
---
bot/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index fc7c2ab35..3af1005a8 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -119,7 +119,7 @@ def main():
ping_handler = CommandHandler(BotCommands.PingCommand, ping,
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
restart_handler = CommandHandler(BotCommands.RestartCommand, restart,
- filters=CustomFilters.owner_filter)
+ filters=CustomFilters.owner_filter| CustomFilters.authorized_user)
help_handler = CommandHandler(BotCommands.HelpCommand,
bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
stats_handler = CommandHandler(BotCommands.StatsCommand,
From 7df994f73b6e828fb00b79545eea4803fcc675bc Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 11:59:08 +0530
Subject: [PATCH 090/190] Update README.md
---
README.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/README.md b/README.md
index 6112a0524..636f7f7ba 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,18 @@
+What Is Modified In My Fork -
+1. Nice Looking Status Message.
+2. Restart Command Also Works For Authorized Users In Authorized Chats.
+3. Added Ability To Do Speed Test Of The Host. (/speed Command) currently in beta.
+4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
+5. Added Custom User Agent ,Peer Agent..Transmission For Now
+
+
+
+All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12, ZeroCool Aka Jaskaran , Magneto And Some Unkown Users Of Git.
+
+
+
+
+
# Important - Read these points first
- Original repo is https://github.com/lzzy12/python-aria-mirror-bot
- I have collected some cool features from various repositories and merged them in one.
From 1b5b05e6458c4dcc5492d59ea536d8daef74dda0 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 12:36:37 +0530
Subject: [PATCH 091/190] A Little More RGB Wouldn't Hurt
---
bot/helper/ext_utils/bot_utils.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index bb7c6ebdf..b21cb3f44 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -92,7 +92,7 @@ def get_readable_message():
with download_dict_lock:
msg = ""
for download in list(download_dict.values()):
- msg += f"Filename : {download.name()}"
+ msg += f"📂Filename : {download.name()}"
msg += f"\nStatus : {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
@@ -100,7 +100,7 @@ def get_readable_message():
msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
- msg += f"\nSpeed : {download.speed()}, \nETA: {download.eta()} "
+ msg += f"\nSpeed ⚡️: {download.speed()}, \n⏳ETA:- {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
@@ -108,7 +108,8 @@ def get_readable_message():
except:
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nGID: {download.gid()}"
+ msg += f"\nGID 🔰 : {download.gid()}" \
+ f"\nTo Stop 🚫 : /{BotCommands.CancelMirror} {download.gid()}"
msg += "\n\n"
return msg
From 59fcd5e934fd3822b0ec932071cb527aae17a9df Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 12:42:39 +0530
Subject: [PATCH 092/190] Old So Deleted
---
config.env | 30 ------------------------------
1 file changed, 30 deletions(-)
delete mode 100644 config.env
diff --git a/config.env b/config.env
deleted file mode 100644
index 6d9044f55..000000000
--- a/config.env
+++ /dev/null
@@ -1,30 +0,0 @@
-BOT_TOKEN = ""
-GDRIVE_FOLDER_ID = ""
-TELEGRAPH_TOKEN = ""
-OWNER_ID =
-DOWNLOAD_DIR = "/bot/downloads"
-DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
-AUTO_DELETE_MESSAGE_DURATION = 20
-IS_TEAM_DRIVE = "True"
-USER_SESSION_STRING = ""
-TELEGRAM_API =
-TELEGRAM_HASH = ""
-USE_SERVICE_ACCOUNTS = ""
-# Optional config
-AUTHORIZED_CHATS = "" #Separated by space
-INDEX_URL = ""
-MEGA_API_KEY = ""
-MEGA_EMAIL_ID = ""
-MEGA_PASSWORD = ""
-STOP_DUPLICATE_MIRROR = ""
-BLOCK_MEGA_LINKS = ""
-SHORTENER = ""
-SHORTENER_API = ""
-# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
-# If you don't know what are below entries, simply leave them, Don't fill anything in them.
-BUTTON_THREE_NAME = ""
-BUTTON_THREE_URL = ""
-BUTTON_FOUR_NAME = ""
-BUTTON_FOUR_URL = ""
-BUTTON_FIVE_NAME = ""
-BUTTON_FIVE_URL = ""
From 54bd29f23a272182a28825d15504575e06066d84 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:03:35 +0530
Subject: [PATCH 093/190] Update requirements.txt
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index 1f3772181..e7a26f888 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -17,3 +17,4 @@ telegraph
appdirs
speedtest-cli
messages
+speedtest
From 8985ff2a3431bc437bbd689e65ecd847a2ffe256 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:06:48 +0530
Subject: [PATCH 094/190] Update requirements.txt
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index e7a26f888..a210d8bff 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -17,4 +17,4 @@ telegraph
appdirs
speedtest-cli
messages
-speedtest
+
From 0f710fb874d0df0743241e144f2f8533388cedd1 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:15:40 +0530
Subject: [PATCH 095/190] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 636f7f7ba..ef9aebb0e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
What Is Modified In My Fork -
1. Nice Looking Status Message.
2. Restart Command Also Works For Authorized Users In Authorized Chats.
-3. Added Ability To Do Speed Test Of The Host. (/speed Command) currently in beta.
+3. Added Ability To Do Speed Test Of The Host. (/speed Command).
4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
5. Added Custom User Agent ,Peer Agent..Transmission For Now
From 93fe7c6113f4ec7090e44970bc6c2db449dbf3a4 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:17:43 +0530
Subject: [PATCH 096/190] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ef9aebb0e..f9bc05e55 100644
--- a/README.md
+++ b/README.md
@@ -3,11 +3,12 @@ What Is Modified In My Fork -
2. Restart Command Also Works For Authorized Users In Authorized Chats.
3. Added Ability To Do Speed Test Of The Host. (/speed Command).
4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
-5. Added Custom User Agent ,Peer Agent..Transmission For Now
+5. Added Custom User Agent ,Peer Agent..Transmission For Now.
All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12, ZeroCool Aka Jaskaran , Magneto And Some Unkown Users Of Git.
+I Am Just Doing The Modification For Personal Use.
From 8ddaa095357f6cd1d90b357f2bfbd00c4cc0bc3a Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:19:12 +0530
Subject: [PATCH 097/190] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f9bc05e55..824489f0d 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ What Is Modified In My Fork -
-All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12, ZeroCool Aka Jaskaran , Magneto And Some Unkown Users Of Git.
+All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto And Some Unkown Users Of Git.
I Am Just Doing The Modification For Personal Use.
From c2fa9291d2d16d80f981c15690bd0b226405ee28 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 13:50:33 +0530
Subject: [PATCH 098/190] Update bot_utils.py
---
bot/helper/ext_utils/bot_utils.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index b21cb3f44..040340064 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -3,6 +3,7 @@
import threading
import time
+from bot.helper.telegram_helper.bot_commands import BotCommands
from bot import download_dict, download_dict_lock
LOGGER = logging.getLogger(__name__)
From ddfcd644e7fe16103ad9b70514bcd9a75c87fcdd Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 14:12:08 +0530
Subject: [PATCH 099/190] Update bot_commands.py
---
bot/helper/telegram_helper/bot_commands.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py
index 7453edb53..2eff85ce0 100644
--- a/bot/helper/telegram_helper/bot_commands.py
+++ b/bot/helper/telegram_helper/bot_commands.py
@@ -7,7 +7,7 @@ def __init__(self):
self.CancelMirror = 'cancel'
self.CancelAllCommand = 'cancelall'
self.ListCommand = 'list'
- self.SpeedCommand = 'speed'
+ self.SpeedCommand = 'speedtest'
self.StatusCommand = 'status'
self.AuthorizeCommand = 'authorize'
self.UnAuthorizeCommand = 'unauthorize'
From d7ed1c88407312ee7652c8d498fc8158391b6741 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 14:20:28 +0530
Subject: [PATCH 100/190] SpeedTest
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 824489f0d..a04fd2e47 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
What Is Modified In My Fork -
1. Nice Looking Status Message.
2. Restart Command Also Works For Authorized Users In Authorized Chats.
-3. Added Ability To Do Speed Test Of The Host. (/speed Command).
+3. Added Ability To Do Speed Test Of The Host. (/speedtest Command).
4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
5. Added Custom User Agent ,Peer Agent..Transmission For Now.
From e4e183364fe77d7f0d0d5bdfa46e22e8f0c3952b Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 22:15:17 +0530
Subject: [PATCH 101/190] More RGB
---
bot/helper/ext_utils/bot_utils.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 040340064..ebc7aa8af 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -101,16 +101,15 @@ def get_readable_message():
msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
- msg += f"\nSpeed ⚡️: {download.speed()}, \n⏳ETA:- {download.eta()} "
+ msg += f"\nSpeed ⚡️: {download.speed()}, \nETA ⏳:- {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
- msg += f"\nInfo :- Seeders: {download.aria_download().num_seeders}" \
+ msg += f"\nInfo ⚓️ :- Seeders: {download.aria_download().num_seeders}" \
f" & Peers : {download.aria_download().connections}"
except:
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nGID 🔰 : {download.gid()}" \
- f"\nTo Stop 🚫 : /{BotCommands.CancelMirror} {download.gid()}"
+ msg += f"\nTo Stop 👉 : /{BotCommands.CancelMirror} {download.gid()}" \
msg += "\n\n"
return msg
From d454e36aa6c0c65d56a7d330dab6463870e6096c Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 22:17:03 +0530
Subject: [PATCH 102/190] More RGB
---
bot/helper/ext_utils/bot_utils.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index ebc7aa8af..0821f2084 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -98,9 +98,9 @@ def get_readable_message():
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nDownloaded ☑️ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
- msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nUploaded ☑️ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
msg += f"\nSpeed ⚡️: {download.speed()}, \nETA ⏳:- {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
From 7f1702e0aa69fde1a751986c5c7f8bae4863f54e Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Feb 2021 23:52:40 +0530
Subject: [PATCH 103/190] Update bot_utils.py
---
bot/helper/ext_utils/bot_utils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 0821f2084..7a6417949 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -109,7 +109,7 @@ def get_readable_message():
except:
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nTo Stop 👉 : /{BotCommands.CancelMirror} {download.gid()}" \
+ msg += f"\nTo Stop 👉 : /{BotCommands.CancelMirror} {download.gid()}"
msg += "\n\n"
return msg
From 17e8909242b3c5e7ed328cb42b5f742d340f56a8 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 01:18:12 +0530
Subject: [PATCH 104/190] Update bot_utils.py
---
bot/helper/ext_utils/bot_utils.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 7a6417949..cf49ef827 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -14,8 +14,8 @@
class MirrorStatus:
- STATUS_UPLOADING = "Uploading...📤"
- STATUS_DOWNLOADING = "Downloading...📥"
+ STATUS_UPLOADING = "Uploading...⏫"
+ STATUS_DOWNLOADING = "Downloading...⏬"
STATUS_WAITING = "Queued...📝"
STATUS_FAILED = "Failed 🚫. Cleaning download"
STATUS_CANCELLED = "Cancelled ❎"
@@ -98,9 +98,9 @@ def get_readable_message():
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nDownloaded ☑️ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
- msg += f"\nUploaded ☑️ : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
msg += f"\nSpeed ⚡️: {download.speed()}, \nETA ⏳:- {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
From e85c8086d9d95af99bbb22ab5fdaee453a9914ec Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 01:24:11 +0530
Subject: [PATCH 105/190] Update __main__.py
---
bot/__main__.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 3af1005a8..c39668a48 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -28,15 +28,15 @@ def stats(update, context):
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
- stats = f'Bot Uptime: {currentTime}\n' \
- f'Total disk space: {total}\n' \
- f'Used: {used} ' \
- f'Free: {free}\n\n' \
- f'📇Data Usage📇\nUpload: {sent}\n' \
- f'Down: {recv}\n\n' \
- f'CPU: {cpuUsage}% ' \
- f'RAM: {memory}% ' \
- f'Disk: {disk}%'
+ stats = f'Bot Uptime ⌚: {currentTime}\n' \
+ f'Total disk space🗄️: {total}\n' \
+ f'Used 🗃️: {used} ' \
+ f'Free 🗃️: {free}\n\n' \
+ f'📇Data Usage📇\nUploaded : {sent}\n' \
+ f'Downloaded: {recv}\n\n' \
+ f'CPU 🖥️: {cpuUsage}% ' \
+ f'RAM ⛏️: {memory}% ' \
+ f'Disk 🗄️: {disk}%'
sendMessage(stats, context.bot, update)
From b5f0983064ee4d08c99a2ebfae2434eaa8c273a8 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 01:28:50 +0530
Subject: [PATCH 106/190] Update mirror.py
---
bot/modules/mirror.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index b337fe05b..da053d2f2 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -174,7 +174,7 @@ def onUploadComplete(self, link: str, size):
else:
uname = f'{self.message.from_user.first_name}'
if uname is not None:
- msg += f'\n\ncc : {uname}'
+ msg += f'\n\nReq. By 👉 : {uname}'
try:
fs_utils.clean_download(download_dict[self.uid].path())
except FileNotFoundError:
@@ -260,7 +260,7 @@ def _mirror(bot, update, isTar=False, extract=False):
listener = MirrorListener(bot, update, pswd, isTar, tag, extract)
if bot_utils.is_mega_link(link):
if BLOCK_MEGA_LINKS:
- sendMessage("Mega links are blocked bcoz mega downloading is too much unstable and buggy. mega support will be added back after fix", bot, update)
+ sendMessage("Mega Links Are Blocked ✋", bot, update)
else:
mega_dl = MegaDownloadHelper()
mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
From bb7df1c829c5a8e92846ab9f02fe5b13f87dd085 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 14:20:23 +0530
Subject: [PATCH 107/190] Update requirements.txt
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index a210d8bff..238c4809a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,6 @@
requests
psutil
+psycopg2-binary
python-telegram-bot==12.6.1
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
From ae931c2a86de2008e44e22a2cb80dd771f944b00 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 14:22:04 +0530
Subject: [PATCH 108/190] fixed a critical bug
fixed a critical requirement that was causing the bot to start
---
requirements.txt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 238c4809a..451c4ca64 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
requests
+progress
psutil
-psycopg2-binary
python-telegram-bot==12.6.1
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
@@ -12,7 +12,8 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram>=0.16.0,<0.16.10
TgCrypto>=1.1.1,<1.1.10
-git+https://gitlab.com/magneto261290/youtube-dl
+psycopg2-binary
+youtube_dl
lxml
telegraph
appdirs
From 8cdc25d66efcea5a3fb25888536242206479d66c Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 15:01:20 +0530
Subject: [PATCH 109/190] Update aria.sh
---
aria.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aria.sh b/aria.sh
index c21c2f2d2..ffeeb5695 100644
--- a/aria.sh
+++ b/aria.sh
@@ -14,6 +14,6 @@ export MAX_CONCURRENT_DOWNLOADS=7
aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 \
--max-connection-per-server=16 --rpc-max-request-size=1024M \
--seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 \
- --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED --bt-stop-timeout=600 \
+ --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED --bt-stop-timeout=1200 \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
--bt-tracker=$tracker --bt-max-peers=0 --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
From c1e807a44a37dc313a6dd3a30cc817719cf9e170 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 15:08:43 +0530
Subject: [PATCH 110/190] Default Trackers
f**k rarbg ...the most shitty trackers .. i have increased the auto cancel time and provided default trackers to solve the issue of rarbg torrent not starting ...please give a little time to start first torrent...
---
trackers.txt | 959 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 959 insertions(+)
create mode 100644 trackers.txt
diff --git a/trackers.txt b/trackers.txt
new file mode 100644
index 000000000..38710b832
--- /dev/null
+++ b/trackers.txt
@@ -0,0 +1,959 @@
+http://104.28.1.30:8080/announce
+
+http://104.28.16.69/announce
+
+http://104.28.16.69:80/announce
+
+http://107.152.127.9:6969/announce
+
+http://1337.abcvg.info:80/announce
+
+http://156.234.201.18:80/announce
+
+http://178.175.143.27/announce
+
+http://178.248.247.244:6969/announce
+
+http://184.105.151.164:6969/announce
+
+http://185.148.3.231:80/announce
+
+http://194.106.216.222/announce
+
+http://54.36.126.137:6969/announce
+
+http://54.39.179.91:6699/announce
+
+http://60-fps.org:80/bt:80/announce.php
+
+http://78.30.254.12:2710/announce
+
+http://81.200.2.231/announce
+
+http://85.17.19.180/announce
+
+http://87.253.152.137/announce
+
+http://91.216.110.47/announce
+
+http://91.217.91.21:3218/announce
+
+http://93.158.213.92:1337/announce
+
+http://93.92.64.5/announce
+
+http://95.107.48.115:80/announce
+
+http://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
+
+http://[2001:470:1:189:0:1:2:3]:6969/announce
+
+http://[2a04:ac00:1:3dd8::1:2710]:2710/announce
+
+http://all4nothin.net:80/announce.php
+
+http://atrack.pow7.com:80/announce
+
+http://baibako.tv:80/announce
+
+http://bobbialbano.com:6969/announce
+
+http://bt-tracker.gamexp.ru:2710/announce
+
+http://bt.1000.pet:2712/announce
+
+http://bt.10000.pet:2714/announce
+
+http://bt.3dmgame.com:2710/announce
+
+http://bt.3kb.xyz:80/announce
+
+http://bt.ali213.net:8080/announce
+
+http://bt.firebit.org:2710/announce
+
+http://bt.okmp3.ru:2710/announce
+
+http://bt.unionpeer.org:777/announce
+
+http://bt.zlofenix.org:81/announce
+
+http://bttracker.debian.org:6969/announce
+
+http://btx.anifilm.tv:80/announce.php
+
+http://data-bg.net:80/announce.php
+
+http://datascene.net:80/announce.php
+
+http://elitezones.ro:80/announce.php
+
+http://explodie.org:6969/announce
+
+http://finbytes.org:80/announce.php
+
+http://h4.trakx.nibba.trade:80/announce
+
+http://ipv4announce.sktorrent.eu:6969/announce
+
+http://irrenhaus.dyndns.dk:80/announce.php
+
+http://kinorun.com:80/announce.php
+
+http://lima-peru.subventas.com:443/announce
+
+http://masters-tb.com:80/announce.php
+
+http://mediaclub.tv:80/announce
+
+http://milanesitracker.tekcities.com:80/announce
+
+http://milliontorrent.pl:80/announce.php
+
+http://mixfiend.com:6969/announce
+
+http://music-torrent.net:2710/announce
+
+http://mvgroup.org:2710/announce
+
+http://ns3107607.ip-54-36-126.eu:6969/announce
+
+http://open.acgnxtracker.com:80/announce
+
+http://open.touki.ru:80/announce
+
+http://open.touki.ru:80/announce.php
+
+http://openbittorrent.com:80/announce
+
+http://opentracker.i2p.rocks:6969/announce
+
+http://potuk.com:2710/announce
+
+http://pow7.com:80/announce
+
+http://proaudiotorrents.org:80/announce.php
+
+http://retracker.hotplug.ru:2710/announce
+
+http://retracker.sevstar.net:2710/announce
+
+http://rt.tace.ru:80/announce
+
+http://secure.pow7.com:80/announce
+
+http://share.camoe.cn:8080/announce
+
+http://siambit.com:80/announce.php
+
+http://siambit.org:80/announce.php
+
+http://t.acg.rip:6699/announce
+
+http://t.nyaatracker.com:80/announce
+
+http://t.overflow.biz:6969/announce
+
+http://t1.leech.ie:80/announce
+
+http://t1.pow7.com:80/announce
+
+http://t2.pow7.com:80/announce
+
+http://torrent.fedoraproject.org:6969/announce
+
+http://torrents.linuxmint.com:80/announce.php
+
+http://torrentsmd.com:8080/announce
+
+http://tr.cili001.com:8070/announce
+
+http://tracker-cdn.moeking.me:2095/announce
+
+http://tracker.ali213.net:8080/announce
+
+http://tracker.anirena.com:80/announce
+
+http://tracker.birkenwald.de:6969/announce
+
+http://tracker.bt4g.com:2095/announce
+
+http://tracker.dler.org:6969/announce
+
+http://tracker.fdn.fr:6969/announce
+
+http://tracker.files.fm:6969/announce
+
+http://tracker.frozen-layer.net:6969/announce
+
+http://tracker.gbitt.info:80/announce
+
+http://tracker.ipv6tracker.ru:80/announce
+
+http://tracker.lelux.fi:80/announce
+
+http://tracker.loadbt.com:6969/announce
+
+http://tracker.noobsubs.net:80/announce
+
+http://tracker.opentrackr.org:1337/announce
+
+http://tracker.pow7.com:80/announce
+
+http://tracker.sakurato.xyz:23333/announce
+
+http://tracker.sloppyta.co:80/announce
+
+http://tracker.tasvideos.org:6969/announce
+
+http://tracker.trackerfix.com:80/announce
+
+http://tracker.uw0.xyz:6969/announce
+
+http://tracker.vraphim.com:6969/announce
+
+http://tracker.xdvdz.com:2710/announce
+
+http://tracker.yoshi210.com:6969/announce
+
+http://tracker.zerobytes.xyz:1337/announce
+
+http://tracker1.itzmx.com:8080/announce
+
+http://tracker2.dler.org:80/announce
+
+http://tracker3.dler.org:2710/announce
+
+http://vpn.flying-datacenter.de:6969/announce
+
+http://vps02.net.orel.ru:80/announce
+
+http://www.all4nothin.net:80/announce.php
+
+http://www.loushao.net:8080/announce
+
+http://www.mvgroup.org:2710/announce
+
+http://www.thetradersden.org/forums/tracker:80/announce.php
+
+http://www.tribalmixes.com:80/announce.php
+
+http://www.wareztorrent.com:80/announce
+
+http://www.worldboxingvideoarchive.com:80/announce.php
+
+http://www.xwt-classics.net:80/announce.php
+
+http://www.zone-torrent.net:80/announce.php
+
+http://xbtrutor.com:2710/announce
+
+https://1337.abcvg.info:443/announce
+
+https://bt.nfshost.com:443/announce
+
+https://opentracker.acgnx.se:443/announce
+
+https://torrent.ubuntu.com:443/announce
+
+https://tp.m-team.cc:443/announce.php
+
+https://tr.ready4.icu:443/announce
+
+https://tr.steins-gate.moe:2096/announce
+
+https://tracker.bt-hash.com:443/announce
+
+https://tracker.coalition.space:443/announce
+
+https://tracker.foreverpirates.co:443/announce
+
+https://tracker.gbitt.info:443/announce
+
+https://tracker.hama3.net:443/announce
+
+https://tracker.imgoingto.icu:443/announce
+
+https://tracker.iriseden.eu:443/announce
+
+https://tracker.lelux.fi:443/announce
+
+https://tracker.lilithraws.cf:443/announce
+
+https://tracker.nanoha.org:443/announce
+
+https://tracker.nitrix.me:443/announce
+
+https://tracker.parrotsec.org:443/announce
+
+https://tracker.shittyurl.org:443/announce
+
+https://tracker.sloppyta.co:443/announce
+
+https://tracker.tamersunion.org:443/announce
+
+https://trakx.herokuapp.com:443/announce
+
+https://w.wwwww.wtf:443/announce
+
+https://www.wareztorrent.com:443/announce
+
+udp://103.196.36.31:6969/announce
+
+udp://103.30.17.23:6969/announce
+
+udp://104.238.198.186:8000/announce
+
+udp://104.244.153.245:6969/announce
+
+udp://104.244.72.77:1337/announce
+
+udp://128.199.70.66:5944/announce
+
+udp://134.209.1.127:6969/announce
+
+udp://138.255.103.83:1337/announce
+
+udp://138.68.171.1:6969/announce
+
+udp://138.68.69.188:6969/announce
+
+udp://144.76.35.202:6969/announce
+
+udp://144.76.82.110:6969/announce
+
+udp://151.236.218.182:6969/announce
+
+udp://151.80.120.114:2710/announce
+
+udp://159.65.202.134:6969/announce
+
+udp://168.119.183.174:80/announce
+
+udp://168.235.67.63:6969/announce
+
+udp://176.123.5.238:3391/announce
+
+udp://176.31.101.42:6969/announce
+
+udp://178.159.40.252:6969/announce
+
+udp://178.33.73.26:2710/announce
+
+udp://185.181.60.67:80/announce
+
+udp://185.21.216.185:6969/announce
+
+udp://185.8.156.2:6969/announce
+
+udp://185.86.149.205:1337/announce
+
+udp://185.92.223.36:6969/announce
+
+udp://188.166.71.230:6969/announce
+
+udp://193.34.92.5:80/announce
+
+udp://195.123.209.40:80/announce
+
+udp://195.128.100.150:6969/announce
+
+udp://195.201.94.195:6969/announce
+
+udp://198.50.195.216:7777/announce
+
+udp://199.187.121.233:6969/announce
+
+udp://199.195.249.193:1337/announce
+
+udp://205.185.121.146:6969/announce
+
+udp://208.83.20.20:6969/announce
+
+udp://209.141.45.244:1337/announce
+
+udp://212.1.226.176:2710/announce
+
+udp://217.12.218.177:2710/announce
+
+udp://27.156.64.128:2710/announce
+
+udp://37.1.205.89:2710/announce
+
+udp://37.235.174.46:2710/announce
+
+udp://45.33.83.49:6969/announce
+
+udp://45.56.65.82:54123/announce
+
+udp://45.77.100.109:6969/announce
+
+udp://46.101.244.237:6969/announce
+
+udp://46.148.18.250:2710/announce
+
+udp://46.4.109.148:6969/announce
+
+udp://47.ip-51-68-199.eu:6969/announce
+
+udp://5.226.148.20:6969/announce
+
+udp://51.15.2.221:6969/announce
+
+udp://51.15.40.114:80/announce
+
+udp://51.254.244.161:6969/announce
+
+udp://51.68.199.47:6969/announce
+
+udp://51.68.34.33:6969/announce
+
+udp://51.77.58.98:6969/announce
+
+udp://51.79.81.233:6969/announce
+
+udp://51.81.46.170:6969/announce
+
+udp://52.58.128.163:6969/announce
+
+udp://62.138.0.158:6969/announce
+
+udp://62.168.229.166:6969/announce
+
+udp://6rt.tace.ru:80/announce
+
+udp://78.30.254.12:2710/announce
+
+udp://89.234.156.205:451/announce
+
+udp://89.234.156.205:80/announce
+
+udp://9.rarbg.com:2710/announce
+
+udp://9.rarbg.me:2710/announce
+
+udp://9.rarbg.me:2780/announce
+
+udp://9.rarbg.to:2710/announce
+
+udp://9.rarbg.to:2730/announce
+
+udp://91.121.145.207:6969/announce
+
+udp://91.149.192.31:6969/announce
+
+udp://91.216.110.52:451/announce
+
+udp://94.23.183.33:6969/announce
+
+udp://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
+
+udp://[2001:470:1:189:0:1:2:3]:6969/announce
+
+udp://[2a03:7220:8083:cd00::1]:451/announce
+
+udp://[2a04:ac00:1:3dd8::1:2710]:2710/announce
+
+udp://admin.videoenpoche.info:6969/announce
+
+udp://anidex.moe:6969/announce
+
+udp://app.icon256.com:8000/announce
+
+udp://blokas.io:6969/announce
+
+udp://bt.firebit.org:2710/announce
+
+udp://bt.okmp3.ru:2710/announce
+
+udp://bt2.3kb.xyz:6969/announce
+
+udp://bt2.54new.com:8080/announce
+
+udp://bubu.mapfactor.com:6969/announce
+
+udp://cdn-1.gamecoast.org:6969/announce
+
+udp://cdn-2.gamecoast.org:6969/announce
+
+udp://code2chicken.nl:6969/announce
+
+udp://concen.org:6969/announce
+
+udp://cutiegirl.ru:6969/announce
+
+udp://daveking.com:6969/announce
+
+udp://discord.heihachi.pw:6969/announce
+
+udp://drumkitx.com:6969/announce
+
+udp://edu.uifr.ru:6969/announce
+
+udp://engplus.ru:6969/announce
+
+udp://exodus.desync.com:6969/announce
+
+udp://explodie.org:6969/announce
+
+udp://fe.dealclub.de:6969/announce
+
+udp://free-tracker.zooki.xyz:6969/announce
+
+udp://inferno.demonoid.is:3391/announce
+
+udp://ipv4.tracker.harry.lu:80/announce
+
+udp://ipv6.tracker.harry.lu:80/announce
+
+udp://ipv6.tracker.zerobytes.xyz:16661/announce
+
+udp://johnrosen1.com:6969/announce
+
+udp://line-net.ru:6969/announce
+
+udp://ln.mtahost.co:6969/announce
+
+udp://mail.realliferpg.de:6969/announce
+
+udp://movies.zsw.ca:6969/announce
+
+udp://mts.tvbit.co:6969/announce
+
+udp://nagios.tks.sumy.ua:80/announce
+
+udp://ns389251.ovh.net:6969/announce
+
+udp://open.demonii.com:1337/announce
+
+udp://open.lolicon.eu:7777/announce
+
+udp://open.stealth.si:80/announce
+
+udp://openbittorrent.com:80/announce
+
+udp://opentor.org:2710/announce
+
+udp://opentracker.i2p.rocks:6969/announce
+
+udp://p4p.arenabg.com:1337/announce
+
+udp://peerfect.org:6969/announce
+
+udp://public-tracker.zooki.xyz:6969/announce
+
+udp://public.popcorn-tracker.org:6969/announce
+
+udp://public.tracker.vraphim.com:6969/announce
+
+udp://qg.lorzl.gq:2710/announce
+
+udp://qg.lorzl.gq:6969/announce
+
+udp://retracker.hotplug.ru:2710/announce
+
+udp://retracker.lanta-net.ru:2710/announce
+
+udp://retracker.netbynet.ru:2710/announce
+
+udp://retracker.nts.su:2710/announce
+
+udp://retracker.sevstar.net:2710/announce
+
+udp://storage.groupees.com:6969/announce
+
+udp://sugoi.pomf.se:80/announce
+
+udp://t1.leech.ie:1337/announce
+
+udp://t2.leech.ie:1337/announce
+
+udp://t3.leech.ie:1337/announce
+
+udp://tc.animereactor.ru:8082/announce
+
+udp://thetracker.org:80/announce
+
+udp://torrentclub.online:54123/announce
+
+udp://tr2.ysagin.top:2710/announce
+
+udp://tracker.0x.tf:6969/announce
+
+udp://tracker.altrosky.nl:6969/announce
+
+udp://tracker.army:6969/announce
+
+udp://tracker.beeimg.com:6969/announce
+
+udp://tracker.birkenwald.de:6969/announce
+
+udp://tracker.bittor.pw:1337/announce
+
+udp://tracker.coppersurfer.tk:1337/announce
+
+udp://tracker.coppersurfer.tk:6969/announce
+
+udp://tracker.cyberia.is:6969/announce
+
+udp://tracker.dler.org:6969/announce
+
+udp://tracker.ds.is:6969/announce
+
+udp://tracker.e-utp.net:6969/announce
+
+udp://tracker.edkj.club:6969/announce
+
+udp://tracker.filemail.com:6969/announce
+
+udp://tracker.flashtorrents.org:6969/announce
+
+udp://tracker.fortu.io:6969/announce
+
+udp://tracker.grepler.com:6969/announce
+
+udp://tracker.ilibr.org:80/announce
+
+udp://tracker.internetwarriors.net:1337/announce
+
+udp://tracker.kali.org:6969/announce
+
+udp://tracker.kuroy.me:5944/announce
+
+udp://tracker.lelux.fi:6969/announce
+
+udp://tracker.open-internet.nl:6969/announce
+
+udp://tracker.openbittorrent.com:80/announce
+
+udp://tracker.opentrackr.org:1337/announce
+
+udp://tracker.piratepublic.com:1337/announce
+
+udp://tracker.pomf.se:80/announce
+
+udp://tracker.sbsub.com:2710/announce
+
+udp://tracker.shkinev.me:6969/announce
+
+udp://tracker.sigterm.xyz:6969/announce
+
+udp://tracker.sktorrent.net:6969/announce
+
+udp://tracker.skyts.net:6969/announce
+
+udp://tracker.swateam.org.uk:2710/announce
+
+udp://tracker.theoks.net:6969/announce
+
+udp://tracker.torrent.eu.org:451/announce
+
+udp://tracker.tvunderground.org.ru:3218/announce
+
+udp://tracker.uw0.xyz:6969/announce
+
+udp://tracker.v6speed.org:6969/announce
+
+udp://tracker.zerobytes.xyz:1337/announce
+
+udp://tracker0.ufibox.com:6969/announce
+
+udp://tracker1.bt.moack.co.kr:80/announce
+
+udp://tracker2.christianbro.pw:6969/announce
+
+udp://tracker2.dler.org:80/announce
+
+udp://tracker3.itzmx.com:6961/announce
+
+udp://tracker4.itzmx.com:2710/announce
+
+udp://u.wwwww.wtf:1/announce
+
+udp://udp-tracker.shittyurl.org:6969/announce
+
+udp://us-tracker.publictracker.xyz:6969/announce
+
+udp://valakas.rollo.dnsabr.com:2710/announce
+
+udp://vibe.community:6969/announce
+
+udp://www.loushao.net:8080/announce
+
+udp://www.torrent.eu.org:451/announce
+
+udp://zer0day.ch:1337/announce
+
+udp://zer0day.to:1337/announce
+
+udp://tracker.opentrackr.org:1337/announce
+
+http://tracker.opentrackr.org:1337/announce
+
+http://tracker.internetwarriors.net:1337/announce
+
+udp://tracker.internetwarriors.net:1337/announce
+
+udp://exodus.desync.com:6969/announce
+
+udp://tracker.cyberia.is:6969/announce
+
+udp://explodie.org:6969/announce
+
+http://explodie.org:6969/announce
+
+udp://47.ip-51-68-199.eu:6969/announce
+
+udp://opentracker.i2p.rocks:6969/announce
+
+http://opentracker.i2p.rocks:6969/announce
+
+http://open.acgnxtracker.com:80/announce
+
+udp://open.stealth.si:80/announce
+
+udp://tracker.ds.is:6969/announce
+
+udp://www.torrent.eu.org:451/announce
+
+udp://tracker.torrent.eu.org:451/announce
+
+udp://tracker.dler.org:6969/announce
+
+http://tracker.dler.org:6969/announce
+
+udp://ipv4.tracker.harry.lu:80/announce
+
+udp://retracker.lanta-net.ru:2710/announce
+
+http://rt.tace.ru:80/announce
+
+udp://valakas.rollo.dnsabr.com:2710/announce
+
+udp://opentor.org:2710/announce
+
+udp://cdn-2.gamecoast.org:6969/announce
+
+udp://cdn-1.gamecoast.org:6969/announce
+
+udp://bt2.archive.org:6969/announce
+
+udp://bt1.archive.org:6969/announce
+
+https://trakx.herokuapp.com:443/announce
+
+http://vps02.net.orel.ru:80/announce
+
+http://t.overflow.biz:6969/announce
+
+http://h4.trakx.nibba.trade:80/announce
+
+udp://vibe.community:6969/announce
+
+udp://tracker4.itzmx.com:2710/announce
+
+udp://tracker1.bt.moack.co.kr:80/announce
+
+udp://tracker0.ufibox.com:6969/announce
+
+udp://tracker.zerobytes.xyz:1337/announce
+
+udp://tracker.v6speed.org:6969/announce
+
+udp://tracker.uw0.xyz:6969/announce
+
+udp://tracker.skyts.net:6969/announce
+
+udp://tracker.shkinev.me:6969/announce
+
+udp://tracker.lelux.fi:6969/announce
+
+udp://tracker.army:6969/announce
+
+udp://tracker.altrosky.nl:6969/announce
+
+udp://torrentclub.online:54123/announce
+
+udp://storage.groupees.com:6969/announce
+
+udp://nagios.tks.sumy.ua:80/announce
+
+udp://mts.tvbit.co:6969/announce
+
+udp://movies.zsw.ca:6969/announce
+
+udp://mail.realliferpg.de:6969/announce
+
+udp://ln.mtahost.co:6969/announce
+
+udp://johnrosen1.com:6969/announce
+
+udp://inferno.demonoid.is:3391/announce
+
+udp://fe.dealclub.de:6969/announce
+
+udp://engplus.ru:6969/announce
+
+udp://edu.uifr.ru:6969/announce
+
+udp://discord.heihachi.pw:6969/announce
+
+udp://daveking.com:6969/announce
+
+udp://cutiegirl.ru:6969/announce
+
+udp://code2chicken.nl:6969/announce
+
+udp://bt.okmp3.ru:2710/announce
+
+udp://blokas.io:6969/announce
+
+udp://aruacfilmes.com.br:6969/announce
+
+https://tracker.lelux.fi:443/announce
+
+http://tracker1.bt.moack.co.kr:80/announce
+
+http://tracker.zerobytes.xyz:1337/announce
+
+http://tracker.skyts.net:6969/announce
+
+http://tracker.noobsubs.net:80/announce
+
+http://tracker.lelux.fi:80/announce
+
+http://tracker-cdn.moeking.me:2095/announce
+
+http://torrentclub.online:54123/announce
+
+http://bt.okmp3.ru:2710/announce
+
+udp://zephir.monocul.us:6969/announce
+
+udp://www.loushao.net:8080/announce
+
+udp://us-tracker.publictracker.xyz:6969/announce
+
+udp://udp-tracker.shittyurl.org:6969/announce
+
+udp://u.wwwww.wtf:1/announce
+
+udp://tracker2.dler.org:80/announce
+
+udp://tracker.zemoj.com:6969/announce
+
+udp://tracker.sigterm.xyz:6969/announce
+
+udp://tracker.loadbt.com:6969/announce
+
+udp://tracker.0x.tf:6969/announce
+
+udp://tr2.ysagin.top:2710/announce
+
+udp://tr.cili001.com:8070/announce
+
+udp://t3.leech.ie:1337/announce
+
+udp://t2.leech.ie:1337/announce
+
+udp://t1.leech.ie:1337/announce
+
+udp://retracker.sevstar.net:2710/announce
+
+udp://retracker.netbynet.ru:2710/announce
+
+udp://qg.lorzl.gq:2710/announce
+
+udp://public-tracker.zooki.xyz:6969/announce
+
+udp://line-net.ru:6969/announce
+
+udp://free-tracker.zooki.xyz:6969/announce
+
+udp://drumkitx.com:6969/announce
+
+udp://camera.lei001.com:6969/announce
+
+udp://bubu.mapfactor.com:6969/announce
+
+udp://bt2.3kb.xyz:6969/announce
+
+udp://bioquantum.co.za:6969/announce
+
+udp://admin.videoenpoche.info:6969/announce
+
+https://w.wwwww.wtf:443/announce
+
+https://tracker.tamersunion.org:443/announce
+
+https://tracker.sloppyta.co:443/announce
+
+https://tracker.nitrix.me:443/announce
+
+https://tracker.nanoha.org:443/announce
+
+https://tracker.imgoingto.icu:443/announce
+
+https://tracker.hama3.net:443/announce
+
+https://tracker.foreverpirates.co:443/announce
+
+https://tracker.coalition.space:443/announce
+
+https://1337.abcvg.info:443/announce
+
+http://www.loushao.net:8080/announce
+
+http://vpn.flying-datacenter.de:6969/announce
+
+http://tracker2.dler.org:80/announce
+
+http://tracker.sloppyta.co:80/announce
+
+http://tracker.loadbt.com:6969/announce
+
+http://tracker.gbitt.info:80/announce
+
+http://tracker.bt4g.com:2095/announce
+
+http://torrenttracker.nwc.acsalaska.net:6969/announce
+
+http://t.nyaatracker.com:80/announce
+
+http://retracker.sevstar.net:2710/announce
+
+http://open.acgtracker.com:1096/announce
+
+http://ns3107607.ip-54-36-126.eu:6969/announce
+
+http://bt.100.pet:2710/announce
+
+http://bobbialbano.com:6969/announce
+
+udp://tracker.kali.org:6969/announce
+
+udp://tracker-udp.gbitt.info:80/announce
+
+udp://tr.bangumi.moe:6969/announce
+
+udp://public.publictracker.xyz:6969/announce
+
+udp://open.lolicon.eu:7777/announce
+
+udp://ns389251.ovh.net:6969/announce
+
+udp://concen.org:6969/announce
+
+udp://bt2.54new.com:8080/announce
+
+udp://bt.firebit.org:2710/announce
+
+udp://anidex.moe:6969/announce
+
+https://tr.ready4.icu:443/announce
+
+http://tracker4.itzmx.com:2710/announce
+
+http://tracker.vraphim.com:6969/announce
+
+http://t.acg.rip:6699/announce
From 490289e33998c0108f90fcb36f67821102c4316e Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 16 Feb 2021 23:14:48 +0530
Subject: [PATCH 111/190] Skip private or NA videos when downloading from yt
playlist
added the feature to skip downloading videos from a yt playlist , which are either not available or made private.
---
.../download_utils/youtube_dl_download_helper.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 3fc6507aa..e4f874834 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -123,7 +123,7 @@ def extractMetaData(self, link, qual, name):
if 'entries' in result:
video = result['entries'][0]
for v in result['entries']:
- if v.get('filesize'):
+ if v and v.get('filesize'):
self.size += float(v['filesize'])
# For playlists, ydl.prepare-filename returns the following format: -.NA
self.name = name.split(f"-{result['id']}")[0]
@@ -151,6 +151,9 @@ def __download(self, link):
self.onDownloadError("Download Cancelled by User!")
def add_download(self, link, path, qual, name):
+ pattern = '^.*(youtu\.be\/|youtube.com\/)(playlist?)'
+ if re.match(pattern, link):
+ self.opts['ignoreerrors'] = True
self.__onDownloadStart()
self.extractMetaData(link, qual, name)
LOGGER.info(f"Downloading with YT-DL: {link}")
From a393378bb9b4e2155aa382e1915a512eb62d34ce Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 18 Feb 2021 11:14:19 +0530
Subject: [PATCH 112/190] Adding Notes Related To Mega Downloads
---
README.md | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index a04fd2e47..ebd2dd296 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,22 @@
-What Is Modified In My Fork -
-1. Nice Looking Status Message.
+
+# - What Modified In My Fork.
+1. Addded Mega Download Support For Complex And Big Size(100-200+) Folders.Read The Msg About Mega Download Below.
2. Restart Command Also Works For Authorized Users In Authorized Chats.
3. Added Ability To Do Speed Test Of The Host. (/speedtest Command).
4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
5. Added Custom User Agent ,Peer Agent..Transmission For Now.
+# Important - About Mega Downloads.
+1. There Is No Max Size Limit For Mega Folder Or File
+2. If A Folder Fails To Download , Import It Into Your Mega Account And Create A Fresh Sharing Link. Weird But Works.
+3. If Mega Download Is Running, Don't Put Torrents Or Direct Link Mirror With It , Crashes Sometime.
+4. We Recommand One Download At Time , If You Have Multicore Instance Or Vps You Can Try Multiple Download At A Time.
+# Another Important Thing, Always Give Credit. These People/Devs Have Worked Really Hard Without Incentive To Make These Awesome Bots. Give Them Respect.
-All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto And Some Unkown Users Of Git.
-I Am Just Doing The Modification For Personal Use.
-
+All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto And Some Unkown Users Of Git. #Check Credits Below For Full Credit Details.
+I Am Just Doing The Modification For Personal Use.
@@ -29,7 +35,7 @@ Not for mega links and magnet/torrents
```
- Rename Drive files
-Let's have some chit chat here - [@Magneto_chit_chat](https://t.me/magneto_chit_chat)
+Let's have some chit chat here - [@Magneto_chit_chat](https://t.me/magneto_chit_chat).
Note :- it is not a Bot Support group. It's only for discussing rubbish things bcoz i want your help to learn coding 😜🤪.
From c0be48e1e2d9bace2bf3a3e07025acbbbdc83a98 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 18 Feb 2021 11:17:42 +0530
Subject: [PATCH 113/190] Added Support For Big Size Mega Folders
Replaced the stock docker image to a little more stable image to make the mega download crash less. and download smoothly.
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 1450df825..91e48321a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM lzzy12/mega-sdk-python:latest
+FROM iamliquidx/megasdk:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
From 64c61b4b69a07886ff9a0e77e6eaeccc7d6ae38c Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 12:26:17 +0530
Subject: [PATCH 114/190] Create Modificaton.md
---
Modificaton.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 Modificaton.md
diff --git a/Modificaton.md b/Modificaton.md
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/Modificaton.md
@@ -0,0 +1 @@
+
From 9b94f800e2e760f5664884d5c43a5dc6e8f55ce4 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 12:26:24 +0530
Subject: [PATCH 115/190] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index ebd2dd296..6cf8f98c0 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **OWNER_ID** : The Telegram user ID (not username) of the owner of the bot
- **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 never automatically delete messages
- **IS_TEAM_DRIVE** : (Optional field) Set to "True" if GDRIVE_FOLDER_ID is from a Team Drive else False or Leave it empty.
+- **AUTHORIZED_CHATS** : (Optional field) Write all the User and Group ID's you want to authorize Bot Separated by Space (Example : "123456789 987654321 -1001234567890") Bot Can Distinguish Between User ID and Group Id & Allow only users to Restart the bot while Group IDs can't Restart the Bot.
- **USE_SERVICE_ACCOUNTS**: (Optional field) (Leave empty if unsure) Whether to use service accounts or not. For this to work see "Using service accounts" section below.
- **INDEX_URL** : (Optional field) Refer to https://github.com/maple3142/GDIndex/ The URL should not have any trailing '/'
- **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
From 20ca18f91986d7fd9039e54eeed92137190134a4 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 20:55:39 +0530
Subject: [PATCH 116/190] Update and rename Modificaton.md to modificaton.md
---
Modificaton.md | 1 -
modificaton.md | 175 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 175 insertions(+), 1 deletion(-)
delete mode 100644 Modificaton.md
create mode 100644 modificaton.md
diff --git a/Modificaton.md b/Modificaton.md
deleted file mode 100644
index 8b1378917..000000000
--- a/Modificaton.md
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/modificaton.md b/modificaton.md
new file mode 100644
index 000000000..bc9f72667
--- /dev/null
+++ b/modificaton.md
@@ -0,0 +1,175 @@
+# A Guide On How To Customise Bot Further for Personal Use.
+
+1. [Customising Bot /start Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-start-Message)
+2. [Changing Bot Commands](https://github.com/iamLiquidX/MirrorX#Changing-Bot-Commands)
+3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX#Changing-Max-Allowed-Downloads-&-Set-Auto-Cancel-Time-If-No-Seeders-Available)
+4. [Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available](https://github.com/iamLiquidX/MirrorX#Customising-Bot-Message-When-Bot-Auto-Cancels-the-Torrent-Due-to-No-Seeders-are-Available)
+5. [Customising Bot Stats Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-Stats-Message)
+6. [Customising Mirror Status](https://github.com/iamLiquidX/MirrorX#Customising-Mirror-Status)
+7. [Customising Mirror Progress Bar](https://github.com/iamLiquidX/MirrorX#Customising-Mirror-Progress-Bar)
+8. [Customising Bot status Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-status-Message)
+9. [Customising Bot After Download Complete Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-After-Download-Complete-Message)
+
+
+# Customising Bot /start Message
+:octocat: In Order to Customise Bot Start Message You have to Edit few lines in `__main__.py` file.
+
+You Can Find `__main__.py` File Here ⬇️
+```
+MirrorX/bot/__main__.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
+```
+In Order to Customise the way you want the start Message of Bot, modify `line 46` & `line 47` from `__main__.py` file
+
+🔗 [Line 46 can be Opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py#L46)
+
+
+
+
+
+### Example :
+Below is the Just an Example of How I Customised start message of my Bot. This is Just to Give you an Idea, You can Customise as You like.
+
+
+
+
+# Changing Bot Commands
+:octocat: In Order to Customise Bot Commands, You have to Edit Commands in `bot_commands.py` File.
+You Can Find `bot_commands.py` File Here ⬇️
+```
+MirrorX/bot/helper/telegram_helper/bot_commands.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/telegram_helper/bot_commands.py
+```
+### Example :
+I Changed My Bot Commands Like Following. You Can easily understand by looking at & edit as you want them.
+
+
+
+# Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available
+:octocat: In Order to Change Max Allowable Torrents at a Time & Auto Cancel If No Seeders are Available, You Have to Edit `aria.sh` file
+
+### Max Allowed Downloads
+You can limit maximum concurrent downloads by changing the value of `MAX_CONCURRENT_DOWNLOADS` in `aria.sh` file. By default, it's set to 7
+### Auto Cancel a Torrent
+You can Set the Bot to Auto Cancel a Torrent, If No Seeders are Available by changing the value of `--bt-stop-timeout` in `aria.sh` file. By default, it's set to 1200. ( It means after 1200 Seconds, Torrent will get Auto Cancelled)
+### If You Don't want the Bot To Auto Cancel The Torrent If No Seeders Availabe
+
+You Have to remove `--bt-stop-timeout=1200` from `Line 17` in `aria.sh` file.
+
+🔗 [Line 17 Can be Opened from Here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/aria.sh#L17)
+
+See the Below Image and Remove the High Lighted Text from `aria.sh`
+
+
+
+# Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available
+:octocat: In Order to edit Bot Auto Cancel Message, You Have to Edit `aria2_download.py` file.
+
+You Can Find the `aria2_download.py` file Here ⬇️
+
+```
+MirrorX/bot/helper/mirror_utils/download_utils/aria2_download.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
+```
+The Line Which You Have to Edit is `Line 65`
+🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
+
+### Example:
+This is How I Modified Auto Cancel Message. You Can Modify as You Like.
+```
+𝐘𝐨𝐮𝐫 𝐓𝐨𝐫𝐫𝐞𝐧𝐭 𝐇𝐚𝐬 𝐍𝐨 𝐒𝐞𝐞𝐝𝐬, ⚠️ 𝐃𝐞𝐚𝐝 𝐓𝐨𝐫𝐫𝐞𝐧𝐭 !
+```
+
+
+
+# Customising Bot Stats Message
+:octocat: In Order to Customise stats Message, You have to Edit few lines in `__main__.py` file.
+
+You Can Find `__main__.py` File Here ⬇️
+```
+MirrorX/bot/__main__.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
+```
+The Lines Which You Have to Edit are from `Line 31` to `Line 39` . You can Customise the emojis and Words .
+### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
+🔗 [Line 31 to 39 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/__main__.py#L31)
+
+
+
+# Customising Mirror Status
+:octocat: In Order To Customise MirrorStatus, You Have to Edit `Line 17` to `Line 23` in `bot_utils.py` file.
+You Can Find `bot_utils.py` File Here ⬇️
+```
+MirrorX/bot/helper/ext_utils/bot_utils.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+```
+🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L17)
+
+
+
+# Customising Mirror Progress Bar
+:octocat: In Order To Customise Mirror Progress Bar, You Have to Edit `Line 27` ,`Line 84` & `Line 87` in `bot_utils.py` file.
+You Can Find `bot_utils.py` File Here ⬇️
+```
+MirrorX/bot/helper/ext_utils/bot_utils.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+```
+🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L27)
+In Line 27 Replace `▓` with the character of your Choice. This Character is Seen When Download Completes.
+
+🔗 [Line 84](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L84)
+In Line 84 Replace `▓` with the character of your Choice. This Character will Indicate the Downloaded Part.
+
+🔗 [Line 87](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L87)
+In Line 84 Replace `░` with the character of your Choice. This Character Will Indicate the Incomplete Download Part
+
+
+
+
+# Customising Bot status Message
+:octocat: In Order To Customise Bot status Message, You Have to Edit `Line 96` to `Line 112` in `bot_utils.py` file.
+
+You Can Find `bot_utils.py` File Here ⬇️
+```
+MirrorX/bot/helper/ext_utils/bot_utils.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+```
+### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
+
+
+
+### Example : This Is How It Looks ⬇️
+
+
+
+# Customising Bot After Download Complete Message
+:octocat: In Order To Customise Bots Message after Downnload Complete, You Have to Edit `Line 149` to `Line 177` in `mirror.py` file.
+You Can Find `mirror.py` File Here ⬇️
+```
+MirrorX/bot/modules/mirror.py
+or
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/modules/mirror.py
+```
+🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/modules/mirror.py#L149)
+
+
+
+### This Is an Example, How I Edited Mine ⬇️
+
+
+### Output of Edited Mirror.py file from Bot Message
+
+
+
+
+### *This is Just a Small Guide using which small small Customisations can be made in Mirror Bot.*
+### *I Hope It is Helpful to Beginners.*
+### *If I Missed any Part, You can request for that.*
+
From 9924f0335a6c8d3b3c56f4db67c6971e0bc28407 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 21:01:09 +0530
Subject: [PATCH 117/190] Update modificaton.md
---
modificaton.md | 53 +++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/modificaton.md b/modificaton.md
index bc9f72667..e1f30c16f 100644
--- a/modificaton.md
+++ b/modificaton.md
@@ -1,14 +1,14 @@
# A Guide On How To Customise Bot Further for Personal Use.
-1. [Customising Bot /start Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-start-Message)
-2. [Changing Bot Commands](https://github.com/iamLiquidX/MirrorX#Changing-Bot-Commands)
-3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX#Changing-Max-Allowed-Downloads-&-Set-Auto-Cancel-Time-If-No-Seeders-Available)
-4. [Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available](https://github.com/iamLiquidX/MirrorX#Customising-Bot-Message-When-Bot-Auto-Cancels-the-Torrent-Due-to-No-Seeders-are-Available)
-5. [Customising Bot Stats Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-Stats-Message)
-6. [Customising Mirror Status](https://github.com/iamLiquidX/MirrorX#Customising-Mirror-Status)
-7. [Customising Mirror Progress Bar](https://github.com/iamLiquidX/MirrorX#Customising-Mirror-Progress-Bar)
-8. [Customising Bot status Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-status-Message)
-9. [Customising Bot After Download Complete Message](https://github.com/iamLiquidX/MirrorX#Customising-Bot-After-Download-Complete-Message)
+1. [Customising Bot /start Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-start-Message)
+2. [Changing Bot Commands](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Bot-Commands)
+3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Max-Allowed-Downloads-&-Set-Auto-Cancel-Time-If-No-Seeders-Available)
+4. [Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Message-When-Bot-Auto-Cancels-the-Torrent-Due-to-No-Seeders-are-Available)
+5. [Customising Bot Stats Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Stats-Message)
+6. [Customising Mirror Status](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Mirror-Status)
+7. [Customising Mirror Progress Bar](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Mirror-Progress-Bar)
+8. [Customising Bot status Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-status-Message)
+9. [Customising Bot After Download Complete Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-After-Download-Complete-Message)
# Customising Bot /start Message
@@ -18,11 +18,11 @@ You Can Find `__main__.py` File Here ⬇️
```
MirrorX/bot/__main__.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py
```
In Order to Customise the way you want the start Message of Bot, modify `line 46` & `line 47` from `__main__.py` file
-🔗 [Line 46 can be Opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py#L46)
+🔗 [Line 46 can be Opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py#L46)

@@ -40,7 +40,7 @@ You Can Find `bot_commands.py` File Here ⬇️
```
MirrorX/bot/helper/telegram_helper/bot_commands.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/telegram_helper/bot_commands.py
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/telegram_helper/bot_commands.py
```
### Example :
I Changed My Bot Commands Like Following. You Can easily understand by looking at & edit as you want them.
@@ -58,7 +58,7 @@ You can Set the Bot to Auto Cancel a Torrent, If No Seeders are Available by cha
You Have to remove `--bt-stop-timeout=1200` from `Line 17` in `aria.sh` file.
-🔗 [Line 17 Can be Opened from Here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/aria.sh#L17)
+🔗 [Line 17 Can be Opened from Here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/aria.sh#L17)
See the Below Image and Remove the High Lighted Text from `aria.sh`
@@ -72,10 +72,10 @@ You Can Find the `aria2_download.py` file Here ⬇️
```
MirrorX/bot/helper/mirror_utils/download_utils/aria2_download.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
```
The Line Which You Have to Edit is `Line 65`
-🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
+🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
### Example:
This is How I Modified Auto Cancel Message. You Can Modify as You Like.
@@ -92,11 +92,11 @@ You Can Find `__main__.py` File Here ⬇️
```
MirrorX/bot/__main__.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py
```
The Lines Which You Have to Edit are from `Line 31` to `Line 39` . You can Customise the emojis and Words .
### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
-🔗 [Line 31 to 39 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/__main__.py#L31)
+🔗 [Line 31 to 39 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/__main__.py#L31)

@@ -106,9 +106,9 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
```
-🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L17)
+🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L17)

@@ -118,15 +118,15 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
```
-🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L27)
+🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L27)
In Line 27 Replace `▓` with the character of your Choice. This Character is Seen When Download Completes.
-🔗 [Line 84](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L84)
+🔗 [Line 84](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L84)
In Line 84 Replace `▓` with the character of your Choice. This Character will Indicate the Downloaded Part.
-🔗 [Line 87](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L87)
+🔗 [Line 87](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L87)
In Line 84 Replace `░` with the character of your Choice. This Character Will Indicate the Incomplete Download Part

@@ -139,7 +139,7 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
```
### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
@@ -155,9 +155,9 @@ You Can Find `mirror.py` File Here ⬇️
```
MirrorX/bot/modules/mirror.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/bot/modules/mirror.py
+https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/modules/mirror.py
```
-🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/modules/mirror.py#L149)
+🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/modules/mirror.py#L149)

@@ -172,4 +172,3 @@ https://github.com/iamLiquidX/MirrorX/blob/master/bot/modules/mirror.py
### *This is Just a Small Guide using which small small Customisations can be made in Mirror Bot.*
### *I Hope It is Helpful to Beginners.*
### *If I Missed any Part, You can request for that.*
-
From 9af542d7ecb2634dc4812f958df67a462c2cb847 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 21:06:06 +0530
Subject: [PATCH 118/190] Update modificaton.md
.
---
modificaton.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modificaton.md b/modificaton.md
index e1f30c16f..f8f716271 100644
--- a/modificaton.md
+++ b/modificaton.md
@@ -2,7 +2,7 @@
1. [Customising Bot /start Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-start-Message)
2. [Changing Bot Commands](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Bot-Commands)
-3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Max-Allowed-Downloads-&-Set-Auto-Cancel-Time-If-No-Seeders-Available)
+3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Max-Allowed-Downloads-and-Set-Auto-Cancel-Time-If-No-Seeders-Available)
4. [Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Message-When-Bot-Auto-Cancels-the-Torrent-Due-to-No-Seeders-are-Available)
5. [Customising Bot Stats Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Stats-Message)
6. [Customising Mirror Status](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Mirror-Status)
@@ -47,7 +47,7 @@ I Changed My Bot Commands Like Following. You Can easily understand by looking a

-# Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available
+# Changing Max Allowed Downloads and Set Auto Cancel Time If No Seeders Available
:octocat: In Order to Change Max Allowable Torrents at a Time & Auto Cancel If No Seeders are Available, You Have to Edit `aria.sh` file
### Max Allowed Downloads
From 097a69e3b7aa7e8aad0c91de8b07877933ef6f34 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 21:18:51 +0530
Subject: [PATCH 119/190] Update README.md
---
README.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/README.md b/README.md
index 6cf8f98c0..5cec66435 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,18 @@
3. If Mega Download Is Running, Don't Put Torrents Or Direct Link Mirror With It , Crashes Sometime.
4. We Recommand One Download At Time , If You Have Multicore Instance Or Vps You Can Try Multiple Download At A Time.
+# [A Guide On How To Customise Bot Further for Personal Use.](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#a-guide-on-how-to-customise-bot-further-for-personal-use)
+### Added A Small Guide Which Has The Following :-
+1. [Customising Bot /start Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-start-Message)
+2. [Changing Bot Commands](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Bot-Commands)
+3. [Changing Max Allowed Downloads & Set Auto Cancel Time If No Seeders Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Changing-Max-Allowed-Downloads-and-Set-Auto-Cancel-Time-If-No-Seeders-Available)
+4. [Customising Bot Message When Bot Auto Cancels the Torrent Due to No Seeders are Available](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Message-When-Bot-Auto-Cancels-the-Torrent-Due-to-No-Seeders-are-Available)
+5. [Customising Bot Stats Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-Stats-Message)
+6. [Customising Mirror Status](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Mirror-Status)
+7. [Customising Mirror Progress Bar](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Mirror-Progress-Bar)
+8. [Customising Bot status Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-status-Message)
+9. [Customising Bot After Download Complete Message](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#Customising-Bot-After-Download-Complete-Message)
+
# Another Important Thing, Always Give Credit. These People/Devs Have Worked Really Hard Without Incentive To Make These Awesome Bots. Give Them Respect.
All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto And Some Unkown Users Of Git. #Check Credits Below For Full Credit Details.
From d7c77bde20eb5ec6965cacec9acea6948ccf2200 Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 21:42:55 +0530
Subject: [PATCH 120/190] fixed permanent Line links to respective files
---
modificaton.md | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/modificaton.md b/modificaton.md
index f8f716271..df0aa5cc8 100644
--- a/modificaton.md
+++ b/modificaton.md
@@ -22,7 +22,7 @@ https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot
```
In Order to Customise the way you want the start Message of Bot, modify `line 46` & `line 47` from `__main__.py` file
-🔗 [Line 46 can be Opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py#L46)
+🔗 [Line 46 can be Opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/__main__.py#L46)

@@ -58,7 +58,7 @@ You can Set the Bot to Auto Cancel a Torrent, If No Seeders are Available by cha
You Have to remove `--bt-stop-timeout=1200` from `Line 17` in `aria.sh` file.
-🔗 [Line 17 Can be Opened from Here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/aria.sh#L17)
+🔗 [Line 17 Can be Opened from Here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/aria.sh#L17)
See the Below Image and Remove the High Lighted Text from `aria.sh`
@@ -75,7 +75,7 @@ or
https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
```
The Line Which You Have to Edit is `Line 65`
-🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
+🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
### Example:
This is How I Modified Auto Cancel Message. You Can Modify as You Like.
@@ -96,7 +96,7 @@ https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot
```
The Lines Which You Have to Edit are from `Line 31` to `Line 39` . You can Customise the emojis and Words .
### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
-🔗 [Line 31 to 39 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/__main__.py#L31)
+🔗 [Line 31 to 39 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/__main__.py#L31)

@@ -108,7 +108,7 @@ MirrorX/bot/helper/ext_utils/bot_utils.py
or
https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
```
-🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L17)
+🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L17)

@@ -120,13 +120,13 @@ MirrorX/bot/helper/ext_utils/bot_utils.py
or
https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
```
-🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L27)
+🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L27)
In Line 27 Replace `▓` with the character of your Choice. This Character is Seen When Download Completes.
-🔗 [Line 84](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L84)
+🔗 [Line 84](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L84)
In Line 84 Replace `▓` with the character of your Choice. This Character will Indicate the Downloaded Part.
-🔗 [Line 87](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/helper/ext_utils/bot_utils.py#L87)
+🔗 [Line 87](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L87)
In Line 84 Replace `░` with the character of your Choice. This Character Will Indicate the Incomplete Download Part

@@ -157,7 +157,7 @@ MirrorX/bot/modules/mirror.py
or
https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/modules/mirror.py
```
-🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/9b94f800e2e760f5664884d5c43a5dc6e8f55ce4/bot/modules/mirror.py#L149)
+🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/modules/mirror.py#L149)

From 016c218cf7d243993bc6aa86270f674e21a38e6d Mon Sep 17 00:00:00 2001
From: Destiny <53997345+destiny6520@users.noreply.github.com>
Date: Thu, 18 Feb 2021 21:51:34 +0530
Subject: [PATCH 121/190] all links fixed
---
modificaton.md | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/modificaton.md b/modificaton.md
index df0aa5cc8..942afcb62 100644
--- a/modificaton.md
+++ b/modificaton.md
@@ -18,7 +18,7 @@ You Can Find `__main__.py` File Here ⬇️
```
MirrorX/bot/__main__.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
```
In Order to Customise the way you want the start Message of Bot, modify `line 46` & `line 47` from `__main__.py` file
@@ -40,7 +40,7 @@ You Can Find `bot_commands.py` File Here ⬇️
```
MirrorX/bot/helper/telegram_helper/bot_commands.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/telegram_helper/bot_commands.py
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/telegram_helper/bot_commands.py
```
### Example :
I Changed My Bot Commands Like Following. You Can easily understand by looking at & edit as you want them.
@@ -72,7 +72,7 @@ You Can Find the `aria2_download.py` file Here ⬇️
```
MirrorX/bot/helper/mirror_utils/download_utils/aria2_download.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/mirror_utils/download_utils/aria2_download.py
```
The Line Which You Have to Edit is `Line 65`
🔗 [Line 65 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/mirror_utils/download_utils/aria2_download.py#L65)
@@ -92,7 +92,7 @@ You Can Find `__main__.py` File Here ⬇️
```
MirrorX/bot/__main__.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/__main__.py
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/__main__.py
```
The Lines Which You Have to Edit are from `Line 31` to `Line 39` . You can Customise the emojis and Words .
### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
@@ -106,7 +106,7 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.py
```
🔗 [Line 17 to 23 can be opened from here](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L17)
@@ -118,7 +118,7 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.py
```
🔗 [Line 27](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/helper/ext_utils/bot_utils.py#L27)
In Line 27 Replace `▓` with the character of your Choice. This Character is Seen When Download Completes.
@@ -139,7 +139,7 @@ You Can Find `bot_utils.py` File Here ⬇️
```
MirrorX/bot/helper/ext_utils/bot_utils.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/helper/ext_utils/bot_utils.p
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/helper/ext_utils/bot_utils.py
```
### Note: Don't Change Anything Which is written in `{ }` , Unless you know what you are doing.
@@ -155,7 +155,7 @@ You Can Find `mirror.py` File Here ⬇️
```
MirrorX/bot/modules/mirror.py
or
-https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md/blob/master/bot/modules/mirror.py
+https://github.com/iamLiquidX/MirrorX/blob/master/bot/modules/mirror.py
```
🔗 [Line 149](https://github.com/iamLiquidX/MirrorX/blob/097a69e3b7aa7e8aad0c91de8b07877933ef6f34/bot/modules/mirror.py#L149)
From 6e7eef35dd79849ef19c53723f80e6bb44b14793 Mon Sep 17 00:00:00 2001
From: Arsalan <35004378+a092devs@users.noreply.github.com>
Date: Sat, 20 Feb 2021 10:08:21 +0530
Subject: [PATCH 122/190] MEGA: Handle TransferTempError (#210)
* Official client retires the transfer until max tries while streaming
* Don't break the transfer chain if a transfer is retrying or queued
* Cancelling the download causes a Segmentation fault
Co-authored-by: Kandarp Tandel
---
.../download_utils/mega_downloader.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 8a7fff574..c655cfa75 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -101,11 +101,20 @@ def onTransferFinish(self, api: MegaApi, transfer: MegaTransfer, error):
LOGGER.error(e)
def onTransferTemporaryError(self, api, transfer, error):
- LOGGER.info(f'Mega download error in file {transfer} {transfer.getFileName()}: {error}')
- self.error = error.toString()
+ filen = transfer.getFileName()
+ state = transfer.getState()
+ errStr = error.toString()
+ LOGGER.info(f'Mega download error in file {transfer} {filen}: {error}')
+
+ if state == 1 or state == 4:
+ # Sometimes MEGA (offical client) can't stream a node either and raises a temp failed error.
+ # Don't break the transfer queue if transfer's in queued (1) or retrying (4) state [causes seg fault]
+ return
+
+ self.error = errStr
if not self.is_cancelled:
self.is_cancelled = True
- self.listener.onDownloadError("TransferTempError: "+self.error)
+ self.listener.onDownloadError(f"TransferTempError: {errStr} ({filen})")
def cancel_download(self):
self.is_cancelled = True
From 6f7cca71fd3fe3615ec8c43adc9af36088f714e2 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 20 Feb 2021 12:34:48 +0530
Subject: [PATCH 123/190] MEGA: Handle TransferTempError
* Official client retires the transfer until max tries while streaming
* Don't break the transfer chain if a transfer is retrying or queued
* Cancelling the download causes a Segmentation fault
Co-authored-by: Kandarp Tandel
@kandnub
---
.../download_utils/mega_downloader.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 8a7fff574..c655cfa75 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -101,11 +101,20 @@ def onTransferFinish(self, api: MegaApi, transfer: MegaTransfer, error):
LOGGER.error(e)
def onTransferTemporaryError(self, api, transfer, error):
- LOGGER.info(f'Mega download error in file {transfer} {transfer.getFileName()}: {error}')
- self.error = error.toString()
+ filen = transfer.getFileName()
+ state = transfer.getState()
+ errStr = error.toString()
+ LOGGER.info(f'Mega download error in file {transfer} {filen}: {error}')
+
+ if state == 1 or state == 4:
+ # Sometimes MEGA (offical client) can't stream a node either and raises a temp failed error.
+ # Don't break the transfer queue if transfer's in queued (1) or retrying (4) state [causes seg fault]
+ return
+
+ self.error = errStr
if not self.is_cancelled:
self.is_cancelled = True
- self.listener.onDownloadError("TransferTempError: "+self.error)
+ self.listener.onDownloadError(f"TransferTempError: {errStr} ({filen})")
def cancel_download(self):
self.is_cancelled = True
From bfa9b5ee9cda3dde9ccf02dd2397c3be92ccc15c Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 20 Feb 2021 12:45:25 +0530
Subject: [PATCH 124/190] Some minor changes
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 5cec66435..a50780bd4 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,7 @@ Deploying is pretty much straight forward and is divided into several steps as f
- Clone this repo:
```
-git clone https://github.com/magneto261290/magneto-python-aria mirror-bot/
+git clone https://github.com/iamLiquidX/MirrorX
cd mirror-bot
```
@@ -206,11 +206,11 @@ sudo dockerd
```
- Build Docker image:
```
-sudo docker build . -t mirror-bot
+sudo docker build . -t mirrorx
```
- Run the image:
```
-sudo docker run mirror-bot
+sudo docker run mirrorx
```
# Using service accounts for uploading to avoid user rate limit
From 1f94dafb64e58b78b1d1178446b58775e5c64b6e Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 20 Feb 2021 13:17:19 +0530
Subject: [PATCH 125/190] Blind Me
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a50780bd4..70e407bff 100644
--- a/README.md
+++ b/README.md
@@ -126,7 +126,7 @@ Deploying is pretty much straight forward and is divided into several steps as f
- Clone this repo:
```
git clone https://github.com/iamLiquidX/MirrorX
-cd mirror-bot
+cd MirrorX
```
- Install requirements
From d4be16be5aac10dab91c3330e7b6e7da334969a9 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 20 Feb 2021 14:10:16 +0530
Subject: [PATCH 126/190] trying to fix the issues
trackerslist to fix issue with some torrent site's torrent not starting still and the failing to download mediafire links
---
aria.sh | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/aria.sh b/aria.sh
index ffeeb5695..bf3c89352 100644
--- a/aria.sh
+++ b/aria.sh
@@ -1,19 +1,10 @@
-file="trackers.txt"
-echo "$(curl -Ns https://trackerslist.com/best_aria2.txt | awk '$1' | tr ',' '\n')" > trackers.txt
-echo "$(curl -Ns https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt)" >> trackers.txt
-tmp=$(sort trackers.txt | uniq) && echo "$tmp" > trackers.txt
-sed -i '/^$/d' trackers.txt
-sed -z -i 's/\n/,/g' trackers.txt
-tracker_list=$(cat trackers.txt)
-if [ -f $file ] ; then
- rm $file
-fi
-tracker="[$tracker_list]"
export MAX_DOWNLOAD_SPEED=0
-export MAX_CONCURRENT_DOWNLOADS=7
-aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 \
- --max-connection-per-server=16 --rpc-max-request-size=1024M \
- --seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 \
- --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED --bt-stop-timeout=1200 \
+tracker_list=$(curl -Ns https://raw.githubusercontent.com/iamLiquidX/trackerlistx/main/trackers.txt | awk '$1' | tr '\n' ',')
+export MAX_CONCURRENT_DOWNLOADS=4
+aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
+ --max-connection-per-server=10 --rpc-max-request-size=1024M \
+ --bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
+ --follow-torrent=mem --split=10 \
+ --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
--max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
- --bt-tracker=$tracker --bt-max-peers=0 --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
+ --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
From a5097846656e994b4810258e43e7d627789179a7 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 20 Feb 2021 14:24:33 +0530
Subject: [PATCH 127/190] Fixed the issues.
1. Fixed the issue with private trackers and rarbg torrent not starting.
2. Medifire download sometime crashing the bot issue is also fixed.
Deleting this useless trackers file now.
---
trackers.txt | 959 ---------------------------------------------------
1 file changed, 959 deletions(-)
delete mode 100644 trackers.txt
diff --git a/trackers.txt b/trackers.txt
deleted file mode 100644
index 38710b832..000000000
--- a/trackers.txt
+++ /dev/null
@@ -1,959 +0,0 @@
-http://104.28.1.30:8080/announce
-
-http://104.28.16.69/announce
-
-http://104.28.16.69:80/announce
-
-http://107.152.127.9:6969/announce
-
-http://1337.abcvg.info:80/announce
-
-http://156.234.201.18:80/announce
-
-http://178.175.143.27/announce
-
-http://178.248.247.244:6969/announce
-
-http://184.105.151.164:6969/announce
-
-http://185.148.3.231:80/announce
-
-http://194.106.216.222/announce
-
-http://54.36.126.137:6969/announce
-
-http://54.39.179.91:6699/announce
-
-http://60-fps.org:80/bt:80/announce.php
-
-http://78.30.254.12:2710/announce
-
-http://81.200.2.231/announce
-
-http://85.17.19.180/announce
-
-http://87.253.152.137/announce
-
-http://91.216.110.47/announce
-
-http://91.217.91.21:3218/announce
-
-http://93.158.213.92:1337/announce
-
-http://93.92.64.5/announce
-
-http://95.107.48.115:80/announce
-
-http://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
-
-http://[2001:470:1:189:0:1:2:3]:6969/announce
-
-http://[2a04:ac00:1:3dd8::1:2710]:2710/announce
-
-http://all4nothin.net:80/announce.php
-
-http://atrack.pow7.com:80/announce
-
-http://baibako.tv:80/announce
-
-http://bobbialbano.com:6969/announce
-
-http://bt-tracker.gamexp.ru:2710/announce
-
-http://bt.1000.pet:2712/announce
-
-http://bt.10000.pet:2714/announce
-
-http://bt.3dmgame.com:2710/announce
-
-http://bt.3kb.xyz:80/announce
-
-http://bt.ali213.net:8080/announce
-
-http://bt.firebit.org:2710/announce
-
-http://bt.okmp3.ru:2710/announce
-
-http://bt.unionpeer.org:777/announce
-
-http://bt.zlofenix.org:81/announce
-
-http://bttracker.debian.org:6969/announce
-
-http://btx.anifilm.tv:80/announce.php
-
-http://data-bg.net:80/announce.php
-
-http://datascene.net:80/announce.php
-
-http://elitezones.ro:80/announce.php
-
-http://explodie.org:6969/announce
-
-http://finbytes.org:80/announce.php
-
-http://h4.trakx.nibba.trade:80/announce
-
-http://ipv4announce.sktorrent.eu:6969/announce
-
-http://irrenhaus.dyndns.dk:80/announce.php
-
-http://kinorun.com:80/announce.php
-
-http://lima-peru.subventas.com:443/announce
-
-http://masters-tb.com:80/announce.php
-
-http://mediaclub.tv:80/announce
-
-http://milanesitracker.tekcities.com:80/announce
-
-http://milliontorrent.pl:80/announce.php
-
-http://mixfiend.com:6969/announce
-
-http://music-torrent.net:2710/announce
-
-http://mvgroup.org:2710/announce
-
-http://ns3107607.ip-54-36-126.eu:6969/announce
-
-http://open.acgnxtracker.com:80/announce
-
-http://open.touki.ru:80/announce
-
-http://open.touki.ru:80/announce.php
-
-http://openbittorrent.com:80/announce
-
-http://opentracker.i2p.rocks:6969/announce
-
-http://potuk.com:2710/announce
-
-http://pow7.com:80/announce
-
-http://proaudiotorrents.org:80/announce.php
-
-http://retracker.hotplug.ru:2710/announce
-
-http://retracker.sevstar.net:2710/announce
-
-http://rt.tace.ru:80/announce
-
-http://secure.pow7.com:80/announce
-
-http://share.camoe.cn:8080/announce
-
-http://siambit.com:80/announce.php
-
-http://siambit.org:80/announce.php
-
-http://t.acg.rip:6699/announce
-
-http://t.nyaatracker.com:80/announce
-
-http://t.overflow.biz:6969/announce
-
-http://t1.leech.ie:80/announce
-
-http://t1.pow7.com:80/announce
-
-http://t2.pow7.com:80/announce
-
-http://torrent.fedoraproject.org:6969/announce
-
-http://torrents.linuxmint.com:80/announce.php
-
-http://torrentsmd.com:8080/announce
-
-http://tr.cili001.com:8070/announce
-
-http://tracker-cdn.moeking.me:2095/announce
-
-http://tracker.ali213.net:8080/announce
-
-http://tracker.anirena.com:80/announce
-
-http://tracker.birkenwald.de:6969/announce
-
-http://tracker.bt4g.com:2095/announce
-
-http://tracker.dler.org:6969/announce
-
-http://tracker.fdn.fr:6969/announce
-
-http://tracker.files.fm:6969/announce
-
-http://tracker.frozen-layer.net:6969/announce
-
-http://tracker.gbitt.info:80/announce
-
-http://tracker.ipv6tracker.ru:80/announce
-
-http://tracker.lelux.fi:80/announce
-
-http://tracker.loadbt.com:6969/announce
-
-http://tracker.noobsubs.net:80/announce
-
-http://tracker.opentrackr.org:1337/announce
-
-http://tracker.pow7.com:80/announce
-
-http://tracker.sakurato.xyz:23333/announce
-
-http://tracker.sloppyta.co:80/announce
-
-http://tracker.tasvideos.org:6969/announce
-
-http://tracker.trackerfix.com:80/announce
-
-http://tracker.uw0.xyz:6969/announce
-
-http://tracker.vraphim.com:6969/announce
-
-http://tracker.xdvdz.com:2710/announce
-
-http://tracker.yoshi210.com:6969/announce
-
-http://tracker.zerobytes.xyz:1337/announce
-
-http://tracker1.itzmx.com:8080/announce
-
-http://tracker2.dler.org:80/announce
-
-http://tracker3.dler.org:2710/announce
-
-http://vpn.flying-datacenter.de:6969/announce
-
-http://vps02.net.orel.ru:80/announce
-
-http://www.all4nothin.net:80/announce.php
-
-http://www.loushao.net:8080/announce
-
-http://www.mvgroup.org:2710/announce
-
-http://www.thetradersden.org/forums/tracker:80/announce.php
-
-http://www.tribalmixes.com:80/announce.php
-
-http://www.wareztorrent.com:80/announce
-
-http://www.worldboxingvideoarchive.com:80/announce.php
-
-http://www.xwt-classics.net:80/announce.php
-
-http://www.zone-torrent.net:80/announce.php
-
-http://xbtrutor.com:2710/announce
-
-https://1337.abcvg.info:443/announce
-
-https://bt.nfshost.com:443/announce
-
-https://opentracker.acgnx.se:443/announce
-
-https://torrent.ubuntu.com:443/announce
-
-https://tp.m-team.cc:443/announce.php
-
-https://tr.ready4.icu:443/announce
-
-https://tr.steins-gate.moe:2096/announce
-
-https://tracker.bt-hash.com:443/announce
-
-https://tracker.coalition.space:443/announce
-
-https://tracker.foreverpirates.co:443/announce
-
-https://tracker.gbitt.info:443/announce
-
-https://tracker.hama3.net:443/announce
-
-https://tracker.imgoingto.icu:443/announce
-
-https://tracker.iriseden.eu:443/announce
-
-https://tracker.lelux.fi:443/announce
-
-https://tracker.lilithraws.cf:443/announce
-
-https://tracker.nanoha.org:443/announce
-
-https://tracker.nitrix.me:443/announce
-
-https://tracker.parrotsec.org:443/announce
-
-https://tracker.shittyurl.org:443/announce
-
-https://tracker.sloppyta.co:443/announce
-
-https://tracker.tamersunion.org:443/announce
-
-https://trakx.herokuapp.com:443/announce
-
-https://w.wwwww.wtf:443/announce
-
-https://www.wareztorrent.com:443/announce
-
-udp://103.196.36.31:6969/announce
-
-udp://103.30.17.23:6969/announce
-
-udp://104.238.198.186:8000/announce
-
-udp://104.244.153.245:6969/announce
-
-udp://104.244.72.77:1337/announce
-
-udp://128.199.70.66:5944/announce
-
-udp://134.209.1.127:6969/announce
-
-udp://138.255.103.83:1337/announce
-
-udp://138.68.171.1:6969/announce
-
-udp://138.68.69.188:6969/announce
-
-udp://144.76.35.202:6969/announce
-
-udp://144.76.82.110:6969/announce
-
-udp://151.236.218.182:6969/announce
-
-udp://151.80.120.114:2710/announce
-
-udp://159.65.202.134:6969/announce
-
-udp://168.119.183.174:80/announce
-
-udp://168.235.67.63:6969/announce
-
-udp://176.123.5.238:3391/announce
-
-udp://176.31.101.42:6969/announce
-
-udp://178.159.40.252:6969/announce
-
-udp://178.33.73.26:2710/announce
-
-udp://185.181.60.67:80/announce
-
-udp://185.21.216.185:6969/announce
-
-udp://185.8.156.2:6969/announce
-
-udp://185.86.149.205:1337/announce
-
-udp://185.92.223.36:6969/announce
-
-udp://188.166.71.230:6969/announce
-
-udp://193.34.92.5:80/announce
-
-udp://195.123.209.40:80/announce
-
-udp://195.128.100.150:6969/announce
-
-udp://195.201.94.195:6969/announce
-
-udp://198.50.195.216:7777/announce
-
-udp://199.187.121.233:6969/announce
-
-udp://199.195.249.193:1337/announce
-
-udp://205.185.121.146:6969/announce
-
-udp://208.83.20.20:6969/announce
-
-udp://209.141.45.244:1337/announce
-
-udp://212.1.226.176:2710/announce
-
-udp://217.12.218.177:2710/announce
-
-udp://27.156.64.128:2710/announce
-
-udp://37.1.205.89:2710/announce
-
-udp://37.235.174.46:2710/announce
-
-udp://45.33.83.49:6969/announce
-
-udp://45.56.65.82:54123/announce
-
-udp://45.77.100.109:6969/announce
-
-udp://46.101.244.237:6969/announce
-
-udp://46.148.18.250:2710/announce
-
-udp://46.4.109.148:6969/announce
-
-udp://47.ip-51-68-199.eu:6969/announce
-
-udp://5.226.148.20:6969/announce
-
-udp://51.15.2.221:6969/announce
-
-udp://51.15.40.114:80/announce
-
-udp://51.254.244.161:6969/announce
-
-udp://51.68.199.47:6969/announce
-
-udp://51.68.34.33:6969/announce
-
-udp://51.77.58.98:6969/announce
-
-udp://51.79.81.233:6969/announce
-
-udp://51.81.46.170:6969/announce
-
-udp://52.58.128.163:6969/announce
-
-udp://62.138.0.158:6969/announce
-
-udp://62.168.229.166:6969/announce
-
-udp://6rt.tace.ru:80/announce
-
-udp://78.30.254.12:2710/announce
-
-udp://89.234.156.205:451/announce
-
-udp://89.234.156.205:80/announce
-
-udp://9.rarbg.com:2710/announce
-
-udp://9.rarbg.me:2710/announce
-
-udp://9.rarbg.me:2780/announce
-
-udp://9.rarbg.to:2710/announce
-
-udp://9.rarbg.to:2730/announce
-
-udp://91.121.145.207:6969/announce
-
-udp://91.149.192.31:6969/announce
-
-udp://91.216.110.52:451/announce
-
-udp://94.23.183.33:6969/announce
-
-udp://[2001:1b10:1000:8101:0:242:ac11:2]:6969/announce
-
-udp://[2001:470:1:189:0:1:2:3]:6969/announce
-
-udp://[2a03:7220:8083:cd00::1]:451/announce
-
-udp://[2a04:ac00:1:3dd8::1:2710]:2710/announce
-
-udp://admin.videoenpoche.info:6969/announce
-
-udp://anidex.moe:6969/announce
-
-udp://app.icon256.com:8000/announce
-
-udp://blokas.io:6969/announce
-
-udp://bt.firebit.org:2710/announce
-
-udp://bt.okmp3.ru:2710/announce
-
-udp://bt2.3kb.xyz:6969/announce
-
-udp://bt2.54new.com:8080/announce
-
-udp://bubu.mapfactor.com:6969/announce
-
-udp://cdn-1.gamecoast.org:6969/announce
-
-udp://cdn-2.gamecoast.org:6969/announce
-
-udp://code2chicken.nl:6969/announce
-
-udp://concen.org:6969/announce
-
-udp://cutiegirl.ru:6969/announce
-
-udp://daveking.com:6969/announce
-
-udp://discord.heihachi.pw:6969/announce
-
-udp://drumkitx.com:6969/announce
-
-udp://edu.uifr.ru:6969/announce
-
-udp://engplus.ru:6969/announce
-
-udp://exodus.desync.com:6969/announce
-
-udp://explodie.org:6969/announce
-
-udp://fe.dealclub.de:6969/announce
-
-udp://free-tracker.zooki.xyz:6969/announce
-
-udp://inferno.demonoid.is:3391/announce
-
-udp://ipv4.tracker.harry.lu:80/announce
-
-udp://ipv6.tracker.harry.lu:80/announce
-
-udp://ipv6.tracker.zerobytes.xyz:16661/announce
-
-udp://johnrosen1.com:6969/announce
-
-udp://line-net.ru:6969/announce
-
-udp://ln.mtahost.co:6969/announce
-
-udp://mail.realliferpg.de:6969/announce
-
-udp://movies.zsw.ca:6969/announce
-
-udp://mts.tvbit.co:6969/announce
-
-udp://nagios.tks.sumy.ua:80/announce
-
-udp://ns389251.ovh.net:6969/announce
-
-udp://open.demonii.com:1337/announce
-
-udp://open.lolicon.eu:7777/announce
-
-udp://open.stealth.si:80/announce
-
-udp://openbittorrent.com:80/announce
-
-udp://opentor.org:2710/announce
-
-udp://opentracker.i2p.rocks:6969/announce
-
-udp://p4p.arenabg.com:1337/announce
-
-udp://peerfect.org:6969/announce
-
-udp://public-tracker.zooki.xyz:6969/announce
-
-udp://public.popcorn-tracker.org:6969/announce
-
-udp://public.tracker.vraphim.com:6969/announce
-
-udp://qg.lorzl.gq:2710/announce
-
-udp://qg.lorzl.gq:6969/announce
-
-udp://retracker.hotplug.ru:2710/announce
-
-udp://retracker.lanta-net.ru:2710/announce
-
-udp://retracker.netbynet.ru:2710/announce
-
-udp://retracker.nts.su:2710/announce
-
-udp://retracker.sevstar.net:2710/announce
-
-udp://storage.groupees.com:6969/announce
-
-udp://sugoi.pomf.se:80/announce
-
-udp://t1.leech.ie:1337/announce
-
-udp://t2.leech.ie:1337/announce
-
-udp://t3.leech.ie:1337/announce
-
-udp://tc.animereactor.ru:8082/announce
-
-udp://thetracker.org:80/announce
-
-udp://torrentclub.online:54123/announce
-
-udp://tr2.ysagin.top:2710/announce
-
-udp://tracker.0x.tf:6969/announce
-
-udp://tracker.altrosky.nl:6969/announce
-
-udp://tracker.army:6969/announce
-
-udp://tracker.beeimg.com:6969/announce
-
-udp://tracker.birkenwald.de:6969/announce
-
-udp://tracker.bittor.pw:1337/announce
-
-udp://tracker.coppersurfer.tk:1337/announce
-
-udp://tracker.coppersurfer.tk:6969/announce
-
-udp://tracker.cyberia.is:6969/announce
-
-udp://tracker.dler.org:6969/announce
-
-udp://tracker.ds.is:6969/announce
-
-udp://tracker.e-utp.net:6969/announce
-
-udp://tracker.edkj.club:6969/announce
-
-udp://tracker.filemail.com:6969/announce
-
-udp://tracker.flashtorrents.org:6969/announce
-
-udp://tracker.fortu.io:6969/announce
-
-udp://tracker.grepler.com:6969/announce
-
-udp://tracker.ilibr.org:80/announce
-
-udp://tracker.internetwarriors.net:1337/announce
-
-udp://tracker.kali.org:6969/announce
-
-udp://tracker.kuroy.me:5944/announce
-
-udp://tracker.lelux.fi:6969/announce
-
-udp://tracker.open-internet.nl:6969/announce
-
-udp://tracker.openbittorrent.com:80/announce
-
-udp://tracker.opentrackr.org:1337/announce
-
-udp://tracker.piratepublic.com:1337/announce
-
-udp://tracker.pomf.se:80/announce
-
-udp://tracker.sbsub.com:2710/announce
-
-udp://tracker.shkinev.me:6969/announce
-
-udp://tracker.sigterm.xyz:6969/announce
-
-udp://tracker.sktorrent.net:6969/announce
-
-udp://tracker.skyts.net:6969/announce
-
-udp://tracker.swateam.org.uk:2710/announce
-
-udp://tracker.theoks.net:6969/announce
-
-udp://tracker.torrent.eu.org:451/announce
-
-udp://tracker.tvunderground.org.ru:3218/announce
-
-udp://tracker.uw0.xyz:6969/announce
-
-udp://tracker.v6speed.org:6969/announce
-
-udp://tracker.zerobytes.xyz:1337/announce
-
-udp://tracker0.ufibox.com:6969/announce
-
-udp://tracker1.bt.moack.co.kr:80/announce
-
-udp://tracker2.christianbro.pw:6969/announce
-
-udp://tracker2.dler.org:80/announce
-
-udp://tracker3.itzmx.com:6961/announce
-
-udp://tracker4.itzmx.com:2710/announce
-
-udp://u.wwwww.wtf:1/announce
-
-udp://udp-tracker.shittyurl.org:6969/announce
-
-udp://us-tracker.publictracker.xyz:6969/announce
-
-udp://valakas.rollo.dnsabr.com:2710/announce
-
-udp://vibe.community:6969/announce
-
-udp://www.loushao.net:8080/announce
-
-udp://www.torrent.eu.org:451/announce
-
-udp://zer0day.ch:1337/announce
-
-udp://zer0day.to:1337/announce
-
-udp://tracker.opentrackr.org:1337/announce
-
-http://tracker.opentrackr.org:1337/announce
-
-http://tracker.internetwarriors.net:1337/announce
-
-udp://tracker.internetwarriors.net:1337/announce
-
-udp://exodus.desync.com:6969/announce
-
-udp://tracker.cyberia.is:6969/announce
-
-udp://explodie.org:6969/announce
-
-http://explodie.org:6969/announce
-
-udp://47.ip-51-68-199.eu:6969/announce
-
-udp://opentracker.i2p.rocks:6969/announce
-
-http://opentracker.i2p.rocks:6969/announce
-
-http://open.acgnxtracker.com:80/announce
-
-udp://open.stealth.si:80/announce
-
-udp://tracker.ds.is:6969/announce
-
-udp://www.torrent.eu.org:451/announce
-
-udp://tracker.torrent.eu.org:451/announce
-
-udp://tracker.dler.org:6969/announce
-
-http://tracker.dler.org:6969/announce
-
-udp://ipv4.tracker.harry.lu:80/announce
-
-udp://retracker.lanta-net.ru:2710/announce
-
-http://rt.tace.ru:80/announce
-
-udp://valakas.rollo.dnsabr.com:2710/announce
-
-udp://opentor.org:2710/announce
-
-udp://cdn-2.gamecoast.org:6969/announce
-
-udp://cdn-1.gamecoast.org:6969/announce
-
-udp://bt2.archive.org:6969/announce
-
-udp://bt1.archive.org:6969/announce
-
-https://trakx.herokuapp.com:443/announce
-
-http://vps02.net.orel.ru:80/announce
-
-http://t.overflow.biz:6969/announce
-
-http://h4.trakx.nibba.trade:80/announce
-
-udp://vibe.community:6969/announce
-
-udp://tracker4.itzmx.com:2710/announce
-
-udp://tracker1.bt.moack.co.kr:80/announce
-
-udp://tracker0.ufibox.com:6969/announce
-
-udp://tracker.zerobytes.xyz:1337/announce
-
-udp://tracker.v6speed.org:6969/announce
-
-udp://tracker.uw0.xyz:6969/announce
-
-udp://tracker.skyts.net:6969/announce
-
-udp://tracker.shkinev.me:6969/announce
-
-udp://tracker.lelux.fi:6969/announce
-
-udp://tracker.army:6969/announce
-
-udp://tracker.altrosky.nl:6969/announce
-
-udp://torrentclub.online:54123/announce
-
-udp://storage.groupees.com:6969/announce
-
-udp://nagios.tks.sumy.ua:80/announce
-
-udp://mts.tvbit.co:6969/announce
-
-udp://movies.zsw.ca:6969/announce
-
-udp://mail.realliferpg.de:6969/announce
-
-udp://ln.mtahost.co:6969/announce
-
-udp://johnrosen1.com:6969/announce
-
-udp://inferno.demonoid.is:3391/announce
-
-udp://fe.dealclub.de:6969/announce
-
-udp://engplus.ru:6969/announce
-
-udp://edu.uifr.ru:6969/announce
-
-udp://discord.heihachi.pw:6969/announce
-
-udp://daveking.com:6969/announce
-
-udp://cutiegirl.ru:6969/announce
-
-udp://code2chicken.nl:6969/announce
-
-udp://bt.okmp3.ru:2710/announce
-
-udp://blokas.io:6969/announce
-
-udp://aruacfilmes.com.br:6969/announce
-
-https://tracker.lelux.fi:443/announce
-
-http://tracker1.bt.moack.co.kr:80/announce
-
-http://tracker.zerobytes.xyz:1337/announce
-
-http://tracker.skyts.net:6969/announce
-
-http://tracker.noobsubs.net:80/announce
-
-http://tracker.lelux.fi:80/announce
-
-http://tracker-cdn.moeking.me:2095/announce
-
-http://torrentclub.online:54123/announce
-
-http://bt.okmp3.ru:2710/announce
-
-udp://zephir.monocul.us:6969/announce
-
-udp://www.loushao.net:8080/announce
-
-udp://us-tracker.publictracker.xyz:6969/announce
-
-udp://udp-tracker.shittyurl.org:6969/announce
-
-udp://u.wwwww.wtf:1/announce
-
-udp://tracker2.dler.org:80/announce
-
-udp://tracker.zemoj.com:6969/announce
-
-udp://tracker.sigterm.xyz:6969/announce
-
-udp://tracker.loadbt.com:6969/announce
-
-udp://tracker.0x.tf:6969/announce
-
-udp://tr2.ysagin.top:2710/announce
-
-udp://tr.cili001.com:8070/announce
-
-udp://t3.leech.ie:1337/announce
-
-udp://t2.leech.ie:1337/announce
-
-udp://t1.leech.ie:1337/announce
-
-udp://retracker.sevstar.net:2710/announce
-
-udp://retracker.netbynet.ru:2710/announce
-
-udp://qg.lorzl.gq:2710/announce
-
-udp://public-tracker.zooki.xyz:6969/announce
-
-udp://line-net.ru:6969/announce
-
-udp://free-tracker.zooki.xyz:6969/announce
-
-udp://drumkitx.com:6969/announce
-
-udp://camera.lei001.com:6969/announce
-
-udp://bubu.mapfactor.com:6969/announce
-
-udp://bt2.3kb.xyz:6969/announce
-
-udp://bioquantum.co.za:6969/announce
-
-udp://admin.videoenpoche.info:6969/announce
-
-https://w.wwwww.wtf:443/announce
-
-https://tracker.tamersunion.org:443/announce
-
-https://tracker.sloppyta.co:443/announce
-
-https://tracker.nitrix.me:443/announce
-
-https://tracker.nanoha.org:443/announce
-
-https://tracker.imgoingto.icu:443/announce
-
-https://tracker.hama3.net:443/announce
-
-https://tracker.foreverpirates.co:443/announce
-
-https://tracker.coalition.space:443/announce
-
-https://1337.abcvg.info:443/announce
-
-http://www.loushao.net:8080/announce
-
-http://vpn.flying-datacenter.de:6969/announce
-
-http://tracker2.dler.org:80/announce
-
-http://tracker.sloppyta.co:80/announce
-
-http://tracker.loadbt.com:6969/announce
-
-http://tracker.gbitt.info:80/announce
-
-http://tracker.bt4g.com:2095/announce
-
-http://torrenttracker.nwc.acsalaska.net:6969/announce
-
-http://t.nyaatracker.com:80/announce
-
-http://retracker.sevstar.net:2710/announce
-
-http://open.acgtracker.com:1096/announce
-
-http://ns3107607.ip-54-36-126.eu:6969/announce
-
-http://bt.100.pet:2710/announce
-
-http://bobbialbano.com:6969/announce
-
-udp://tracker.kali.org:6969/announce
-
-udp://tracker-udp.gbitt.info:80/announce
-
-udp://tr.bangumi.moe:6969/announce
-
-udp://public.publictracker.xyz:6969/announce
-
-udp://open.lolicon.eu:7777/announce
-
-udp://ns389251.ovh.net:6969/announce
-
-udp://concen.org:6969/announce
-
-udp://bt2.54new.com:8080/announce
-
-udp://bt.firebit.org:2710/announce
-
-udp://anidex.moe:6969/announce
-
-https://tr.ready4.icu:443/announce
-
-http://tracker4.itzmx.com:2710/announce
-
-http://tracker.vraphim.com:6969/announce
-
-http://t.acg.rip:6699/announce
From 8e470cc1f1553cce6b1c1a8594b49da9d4f3a87b Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sun, 21 Feb 2021 11:46:53 +0530
Subject: [PATCH 128/190] Mega.nz: keep listener reference in global list
---
bot/helper/mirror_utils/download_utils/mega_downloader.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index c655cfa75..af6bc444f 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -131,6 +131,7 @@ def do(self, function, args):
function(*args)
self.continue_event.wait()
+listeners = []
class MegaDownloadHelper:
def __init__(self):
@@ -143,7 +144,9 @@ def add_download(mega_link: str, path: str, listener):
raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror mega links')
executor = AsyncExecutor()
api = MegaApi(MEGA_API_KEY, None, None, 'telegram-mirror-bot')
+ global listeners
mega_listener = MegaAppListener(executor.continue_event, listener)
+ listeners.append(mega_listener)
with download_dict_lock:
download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
os.makedirs(path)
@@ -164,4 +167,4 @@ def add_download(mega_link: str, path: str, listener):
return listener.onDownloadError(str(mega_listener.error))
gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
mega_listener.setValues(node.getName(), api.getSize(node), gid)
- executor.do(api.startDownload,(node,path))
+ executor.do(api.startDownload,(node,path))
\ No newline at end of file
From 53d595ca42222d571331d25376a50dda3f71ae8b Mon Sep 17 00:00:00 2001
From: jaskaranSM
Date: Sun, 21 Feb 2021 17:31:59 +0530
Subject: [PATCH 129/190] Mega.nz: try to fix dead link bot crash issue
---
bot/helper/mirror_utils/download_utils/mega_downloader.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index af6bc444f..87f1009a7 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -61,7 +61,9 @@ def onRequestStart(self, api, request):
def onRequestFinish(self, api, request, error):
LOGGER.info('Mega Request finished ({}); Result: {}'
.format(request, error))
-
+ if str(error).lower() != "no error":
+ self.error = error.copy()
+ return
request_type = request.getType()
if request_type == MegaRequest.TYPE_LOGIN:
api.fetchNodes()
From d83aa73baa7c0990ddc68f9756b92e6c9ebd767e Mon Sep 17 00:00:00 2001
From: Billaids <36324542+Billaids@users.noreply.github.com>
Date: Fri, 5 Mar 2021 09:41:21 +0100
Subject: [PATCH 130/190] requirements.txt: use pyrogram v0.18.0 to fix flood
wait exceptions
pyrogram.client.client - ERROR - [420 FLOOD_WAIT_X]: A wait of 3 seconds is required (caused by "upload.GetFile")
this exceptions was fixed in this commit in version v0.18.0
https://github.com/pyrogram/pyrogram/commit/99aee987bdc0154c875c3072cf368f4e9c31aee3
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 1fe407f6e..65bc7a86f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@ python-dotenv>=0.10
tenacity>=6.0.0
python-magic
beautifulsoup4>=4.8.2,<4.8.10
-Pyrogram>=0.16.0,<0.16.10
+Pyrogram==0.18.0
TgCrypto>=1.1.1,<1.1.10
git+https://gitlab.com/magneto261290/youtube-dl
lxml
From fb78dc4d2bb0a997fd04959f3ff1068ea3bfcf4f Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 5 Mar 2021 19:58:57 +0530
Subject: [PATCH 131/190] UpToBox Token Config
---
bot/__init__.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bot/__init__.py b/bot/__init__.py
index a7881ae80..618610ba6 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -106,6 +106,11 @@ def getConfig(name: str):
telegraph_token = telegraph.get_access_token()
LOGGER.info("Telegraph Token Generated: '" + telegraph_token + "'")
+try:
+ UPTOBOX_TOKEN = getConfig('UPTOBOX_TOKEN')
+except KeyError:
+ logging.warning('UPTOBOX_TOKEN not provided!')
+ UPTOBOX_TOKEN = None
try:
MEGA_API_KEY = getConfig('MEGA_API_KEY')
except KeyError:
From 57ab70fb4fcbc4d996188943d406593f003939c6 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 5 Mar 2021 20:00:35 +0530
Subject: [PATCH 132/190] Variable For UpToBox Token
---
config_sample.env | 1 +
1 file changed, 1 insertion(+)
diff --git a/config_sample.env b/config_sample.env
index 8be9fa649..1b0ebdedf 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -15,6 +15,7 @@ USE_SERVICE_ACCOUNTS = ""
# Optional config
AUTHORIZED_CHATS = "" #Separated by space
INDEX_URL = ""
+UPTOBOX_TOKEN = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
MEGA_PASSWORD = ""
From c9f575a8cb32aadfaaf638f26fa68442e256e4c9 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 5 Mar 2021 20:04:56 +0530
Subject: [PATCH 133/190] UpToBox Support
Premium account of UpToBox is must. Not working for normal account.
---
.../download_utils/direct_link_generator.py | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/bot/helper/mirror_utils/download_utils/direct_link_generator.py b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
index 84ea43a5b..8b0fa7b07 100644
--- a/bot/helper/mirror_utils/download_utils/direct_link_generator.py
+++ b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
@@ -15,6 +15,8 @@
from random import choice
import requests
+import logging
+from bot import UPTOBOX_TOKEN
from bs4 import BeautifulSoup
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
@@ -32,6 +34,8 @@ def direct_link_generator(link: str):
return cm_ru(link)
elif 'mediafire.com' in link:
return mediafire(link)
+ elif 'uptobox.com' in link:
+ return uptobox(link)
elif 'osdn.net' in link:
return osdn(link)
elif 'github.com' in link:
@@ -113,6 +117,44 @@ def mediafire(url: str) -> str:
return dl_url
+def uptobox(url: str) -> str:
+ try:
+ link = re.findall(r'\bhttps?://.*uptobox\.com\S+', url)[0]
+ except IndexError:
+ raise DirectDownloadLinkException("`No Uptobox links found`\n")
+ if UPTOBOX_TOKEN is None:
+ logging.error('UPTOBOX_TOKEN not provided!')
+ else:
+ check = 'https://uptobox.com/api/user/me?token=%s' % (UPTOBOX_TOKEN)
+ request = requests.get(check)
+ info = request.json()
+ premium = info["data"]["premium"]
+ try:
+ link = re.findall(r'\bhttp?://.*uptobox\.com/dl\S+', url)[0]
+ logging.info('Uptobox direct link')
+ dl_url = url
+ except:
+ if premium == 1:
+ file_id = re.findall(r'\bhttps?://.*uptobox\.com/(\w+)', url)[0]
+ file_link = 'https://uptobox.com/api/link?token=%s&file_code=%s' % (UPTOBOX_TOKEN, file_id)
+ req = requests.get(file_link)
+ result = req.json()
+ dl_url = result['data']['dlLink']
+ else:
+ file_id = re.findall(r'\bhttps?://.*uptobox\.com/(\w+)', url)[0]
+ file_link = 'https://uptobox.com/api/link?token=%s&file_code=%s' % (UPTOBOX_TOKEN, file_id)
+ req = requests.get(file_link)
+ result = req.json()
+ waiting_time = result["data"]["waiting"] + 1
+ waiting_token = result["data"]["waitingToken"]
+ _countdown(waiting_time)
+ file_link = 'https://uptobox.com/api/link?token=%s&file_code=%s&waitingToken=%s' % (UPTOBOX_TOKEN, file_id, waiting_token)
+ req = requests.get(file_link)
+ result = req.json()
+ dl_url = result['data']['dlLink']
+ return dl_url
+
+
def osdn(url: str) -> str:
""" OSDN direct links generator """
osdn_link = 'https://osdn.net'
From 1cee5bee204942294c5877974b50b6d585aa41d8 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 5 Mar 2021 20:08:23 +0530
Subject: [PATCH 134/190] UpToBox Related Things........
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 70e407bff..e1ddb7156 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# - What Modified In My Fork.
1. Addded Mega Download Support For Complex And Big Size(100-200+) Folders.Read The Msg About Mega Download Below.
-2. Restart Command Also Works For Authorized Users In Authorized Chats.
+2. Added Support For UpToBox Links (Premium Account Needed).
3. Added Ability To Do Speed Test Of The Host. (/speedtest Command).
4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
5. Added Custom User Agent ,Peer Agent..Transmission For Now.
@@ -161,6 +161,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **INDEX_URL** : (Optional field) Refer to https://github.com/maple3142/GDIndex/ The URL should not have any trailing '/'
- **API_KEY** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes.
- **API_HASH** : This is to authenticate to your telegram account for downloading Telegram files. You can get this from https://my.telegram.org
+- **UPTOBOX_TOKEN** : This is to download files using premium account of UpToBox. You can get this from https://uptobox.com/my_account
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
- **MEGA_PASSWORD**: Your password for your mega.nz account
From 7ba17028743929bc1f4b02e44fcd96cb5c861279 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 9 Mar 2021 15:33:05 +0530
Subject: [PATCH 135/190] Modified Ytdl
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index f708a73d1..2eed217c2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -13,7 +13,7 @@ beautifulsoup4>=4.8.2,<4.8.10
Pyrogram==0.18.0
TgCrypto>=1.1.1,<1.1.10
psycopg2-binary
-youtube_dl
+git+https://github.com/yt-dlp/yt-dlp
lxml
telegraph
appdirs
From d47842cda7c487acbc7332e2ca2994d74039f503 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 9 Mar 2021 15:35:04 +0530
Subject: [PATCH 136/190] Just A Diffrent Ytdl Fork
---
.../mirror_utils/download_utils/youtube_dl_download_helper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index e4f874834..6363c8a62 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -1,6 +1,6 @@
from .download_helper import DownloadHelper
import time
-from youtube_dl import YoutubeDL, DownloadError
+from yt_dlp import YoutubeDL, DownloadError
from bot import download_dict_lock, download_dict
from ..status_utils.youtube_dl_download_status import YoutubeDLDownloadStatus
import logging
From dddd9fb4eda1aaeeabe0ca5d558821ca91fdc1b8 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 9 Mar 2021 15:41:28 +0530
Subject: [PATCH 137/190] Indian Streaming Sites Support..
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e1ddb7156..6fe5ae0b1 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
1. Addded Mega Download Support For Complex And Big Size(100-200+) Folders.Read The Msg About Mega Download Below.
2. Added Support For UpToBox Links (Premium Account Needed).
3. Added Ability To Do Speed Test Of The Host. (/speedtest Command).
-4. Update The Aria.sh To Support Multiple Trackers List. Currently Two
+4. Added Support For Indian Streaming Sites Like Hotstar, Zee5, Mx Player, Voot, And Many Others........
5. Added Custom User Agent ,Peer Agent..Transmission For Now.
# Important - About Mega Downloads.
From de64ec1b7bfd74ab6aa7d78852f06473f0dcff42 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 9 Mar 2021 20:29:52 +0530
Subject: [PATCH 138/190] Update requirements.txt
---
requirements.txt | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 2eed217c2..0da642503 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,17 @@
requests
progress
psutil
-python-telegram-bot==12.6.1
-google-api-python-client>=1.7.11,<1.7.20
-google-auth-httplib2>=0.0.3,<0.1.0
-google-auth-oauthlib>=0.4.1,<0.10.0
-aria2p>=0.9.0,<0.15.0
-python-dotenv>=0.10
-tenacity>=6.0.0
+python-telegram-bot
+google-api-python-client
+google-auth-httplib2
+google-auth-oauthlib
+aria2p
+python-dotenv
+tenacity
python-magic
-beautifulsoup4>=4.8.2,<4.8.10
-Pyrogram==0.18.0
-TgCrypto>=1.1.1,<1.1.10
+beautifulsoup4
+Pyrogram
+TgCrypto
psycopg2-binary
git+https://github.com/yt-dlp/yt-dlp
lxml
From fb03164a87b5de5943d5ca66285de52039bedca2 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 9 Mar 2021 20:57:16 +0530
Subject: [PATCH 139/190] Reverting
---
requirements.txt | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 0da642503..a635795d1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,17 @@
requests
progress
psutil
-python-telegram-bot
-google-api-python-client
-google-auth-httplib2
-google-auth-oauthlib
-aria2p
-python-dotenv
-tenacity
+python-telegram-bot==12.6.1
+google-api-python-client>=1.7.11,<1.7.20
+google-auth-httplib2>=0.0.3,<0.1.0
+google-auth-oauthlib>=0.4.1,<0.10.0
+aria2p>=0.9.0,<0.15.0
+python-dotenv>=0.10
+tenacity>=6.0.0
python-magic
-beautifulsoup4
-Pyrogram
-TgCrypto
+beautifulsoup4>=4.8.2,<4.8.10
+Pyrogram==0.18.0
+TgCrypto>=1.1.1,<1.1.10
psycopg2-binary
git+https://github.com/yt-dlp/yt-dlp
lxml
@@ -19,4 +19,3 @@ telegraph
appdirs
speedtest-cli
messages
-
From 468301132b0d39a70cdbe26b89adf7be107fa374 Mon Sep 17 00:00:00 2001
From: Nenokkadine
Date: Mon, 15 Mar 2021 05:12:19 +0000
Subject: [PATCH 140/190] - Upgrade to PTB 13.4.1 - Use Aria2c for
HLS/Dash(Faster than FFMpeg) - Merge all available Audio Streams in the same
video - Remove Unused PSQL Binary in Requirements
---
bot/__main__.py | 20 +++++++------------
.../youtube_dl_download_helper.py | 4 +++-
bot/helper/telegram_helper/filters.py | 10 +++++-----
bot/modules/authorize.py | 7 ++-----
bot/modules/cancel_mirror.py | 8 +++-----
bot/modules/delete.py | 5 ++---
bot/modules/list.py | 5 ++---
bot/modules/mirror.py | 13 ++++--------
bot/modules/mirror_status.py | 5 ++---
bot/modules/speedtest.py | 5 ++---
bot/modules/watch.py | 9 ++++-----
requirements.txt | 5 ++---
12 files changed, 38 insertions(+), 58 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index c39668a48..52b9efc7a 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -6,7 +6,7 @@
from sys import executable
import time
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot import dispatcher, updater, botStartTime
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
@@ -16,7 +16,6 @@
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest
-@run_async
def stats(update, context):
currentTime = get_readable_time((time.time() - botStartTime))
total, used, free = shutil.disk_usage('.')
@@ -40,7 +39,6 @@ def stats(update, context):
sendMessage(stats, context.bot, update)
-@run_async
def start(update, context):
start_string = f'''
This is a bot which can mirror all your links to Google drive!
@@ -49,7 +47,6 @@ def start(update, context):
sendMessage(start_string, context.bot, update)
-@run_async
def restart(update, context):
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
# Save restart message object in order to reply to it after restarting
@@ -59,7 +56,6 @@ def restart(update, context):
execl(executable, executable, "-m", "bot")
-@run_async
def ping(update, context):
start_time = int(round(time.time() * 1000))
reply = sendMessage("Starting Ping", context.bot, update)
@@ -67,12 +63,10 @@ def ping(update, context):
editMessage(f'{end_time - start_time} ms', reply)
-@run_async
def log(update, context):
sendLogFile(context.bot, update)
-@run_async
def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
@@ -115,16 +109,16 @@ def main():
remove('restart.pickle')
start_handler = CommandHandler(BotCommands.StartCommand, start,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
ping_handler = CommandHandler(BotCommands.PingCommand, ping,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
restart_handler = CommandHandler(BotCommands.RestartCommand, restart,
- filters=CustomFilters.owner_filter| CustomFilters.authorized_user)
+ filters=CustomFilters.owner_filter| CustomFilters.authorized_user, run_async=True)
help_handler = CommandHandler(BotCommands.HelpCommand,
- bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
stats_handler = CommandHandler(BotCommands.StatsCommand,
- stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
- log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
+ stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(ping_handler)
dispatcher.add_handler(restart_handler)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 6363c8a62..7b80c7753 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -43,7 +43,9 @@ def __init__(self, listener):
self.opts = {
'progress_hooks': [self.__onDownloadProgress],
'logger': MyLogger(self),
- 'usenetrc': True
+ 'usenetrc': True,
+ 'external_downloader' : 'aria2c',
+ 'allow_multiple_audio_streams' : True
}
self.__download_speed = 0
self.download_speed_readable = ''
diff --git a/bot/helper/telegram_helper/filters.py b/bot/helper/telegram_helper/filters.py
index 3cd3c9363..b40b0217f 100644
--- a/bot/helper/telegram_helper/filters.py
+++ b/bot/helper/telegram_helper/filters.py
@@ -1,29 +1,29 @@
-from telegram.ext import BaseFilter
+from telegram.ext import MessageFilter
from telegram import Message
from bot import AUTHORIZED_CHATS, OWNER_ID, download_dict, download_dict_lock
class CustomFilters:
- class _OwnerFilter(BaseFilter):
+ class _OwnerFilter(MessageFilter):
def filter(self, message):
return bool(message.from_user.id == OWNER_ID)
owner_filter = _OwnerFilter()
- class _AuthorizedUserFilter(BaseFilter):
+ class _AuthorizedUserFilter(MessageFilter):
def filter(self, message):
id = message.from_user.id
return bool(id in AUTHORIZED_CHATS or id == OWNER_ID)
authorized_user = _AuthorizedUserFilter()
- class _AuthorizedChat(BaseFilter):
+ class _AuthorizedChat(MessageFilter):
def filter(self, message):
return bool(message.chat.id in AUTHORIZED_CHATS)
authorized_chat = _AuthorizedChat()
- class _MirrorOwner(BaseFilter):
+ class _MirrorOwner(MessageFilter):
def filter(self, message: Message):
user_id = message.from_user.id
if user_id == OWNER_ID:
diff --git a/bot/modules/authorize.py b/bot/modules/authorize.py
index fedb4d1ac..92679f429 100644
--- a/bot/modules/authorize.py
+++ b/bot/modules/authorize.py
@@ -1,5 +1,4 @@
from bot.helper.telegram_helper.message_utils import sendMessage
-from telegram.ext import run_async
from bot import AUTHORIZED_CHATS, dispatcher
from telegram.ext import CommandHandler
from bot.helper.telegram_helper.filters import CustomFilters
@@ -8,7 +7,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
-@run_async
def authorize(update,context):
reply_message = update.message.reply_to_message
msg = ''
@@ -34,7 +32,6 @@ def authorize(update,context):
sendMessage(msg, context.bot, update)
-@run_async
def unauthorize(update,context):
reply_message = update.message.reply_to_message
if reply_message is None:
@@ -61,9 +58,9 @@ def unauthorize(update,context):
authorize_handler = CommandHandler(command=BotCommands.AuthorizeCommand, callback=authorize,
- filters=CustomFilters.owner_filter & Filters.group)
+ filters=CustomFilters.owner_filter & Filters.group, run_async=True)
unauthorize_handler = CommandHandler(command=BotCommands.UnAuthorizeCommand, callback=unauthorize,
- filters=CustomFilters.owner_filter & Filters.group)
+ filters=CustomFilters.owner_filter & Filters.group, run_async=True)
dispatcher.add_handler(authorize_handler)
dispatcher.add_handler(unauthorize_handler)
diff --git a/bot/modules/cancel_mirror.py b/bot/modules/cancel_mirror.py
index a4d2d7415..8d0d3a671 100644
--- a/bot/modules/cancel_mirror.py
+++ b/bot/modules/cancel_mirror.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot import download_dict, dispatcher, download_dict_lock, DOWNLOAD_DIR
from bot.helper.ext_utils.fs_utils import clean_download
@@ -10,7 +10,6 @@
from bot.helper.ext_utils.bot_utils import getDownloadByGid, MirrorStatus
-@run_async
def cancel_mirror(update, context):
args = update.message.text.split(" ", maxsplit=1)
mirror_message = None
@@ -51,7 +50,6 @@ def cancel_mirror(update, context):
clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/')
-@run_async
def cancel_all(update, context):
with download_dict_lock:
count = 0
@@ -65,8 +63,8 @@ def cancel_all(update, context):
cancel_mirror_handler = CommandHandler(BotCommands.CancelMirror, cancel_mirror,
- filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter)
+ filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True)
cancel_all_handler = CommandHandler(BotCommands.CancelAllCommand, cancel_all,
- filters=CustomFilters.owner_filter)
+ filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(cancel_all_handler)
dispatcher.add_handler(cancel_mirror_handler)
diff --git a/bot/modules/delete.py b/bot/modules/delete.py
index 783d9fc2c..a7e95cc37 100644
--- a/bot/modules/delete.py
+++ b/bot/modules/delete.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
import threading
from telegram import Update
from bot import dispatcher, LOGGER
@@ -7,7 +7,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.mirror_utils.upload_utils import gdriveTools
-@run_async
def deletefile(update, context):
msg_args = update.message.text.split(None, 1)
msg = ''
@@ -26,5 +25,5 @@ def deletefile(update, context):
threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
delete_handler = CommandHandler(command=BotCommands.deleteCommand, callback=deletefile,
- filters=CustomFilters.owner_filter)
+ filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(delete_handler)
\ No newline at end of file
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 0b15f0fdc..81d0dd32e 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -1,11 +1,10 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot import LOGGER, dispatcher
from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup, editMessage
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
-@run_async
def list_drive(update,context):
try:
search = update.message.text.split(' ',maxsplit=1)[1]
@@ -23,5 +22,5 @@ def list_drive(update,context):
sendMessage('send a search key along with command', context.bot, update)
-list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(list_handler)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index da053d2f2..04628435a 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -1,5 +1,5 @@
import requests
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
@@ -272,27 +272,22 @@ def _mirror(bot, update, isTar=False, extract=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-@run_async
def mirror(update, context):
_mirror(context.bot, update)
-
-@run_async
def tar_mirror(update, context):
_mirror(context.bot, update, True)
-
-@run_async
def unzip_mirror(update, context):
_mirror(context.bot, update, extract=True)
mirror_handler = CommandHandler(BotCommands.MirrorCommand, mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
tar_mirror_handler = CommandHandler(BotCommands.TarMirrorCommand, tar_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
unzip_mirror_handler = CommandHandler(BotCommands.UnzipMirrorCommand, unzip_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
dispatcher.add_handler(unzip_mirror_handler)
diff --git a/bot/modules/mirror_status.py b/bot/modules/mirror_status.py
index e4ae32494..482d17ad6 100644
--- a/bot/modules/mirror_status.py
+++ b/bot/modules/mirror_status.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot import dispatcher, status_reply_dict, DOWNLOAD_STATUS_UPDATE_INTERVAL, status_reply_dict_lock
from bot.helper.telegram_helper.message_utils import *
from time import sleep
@@ -8,7 +8,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
import threading
-@run_async
def mirror_status(update,context):
message = get_readable_message()
if len(message) == 0:
@@ -26,5 +25,5 @@ def mirror_status(update,context):
mirror_status_handler = CommandHandler(BotCommands.StatusCommand, mirror_status,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_status_handler)
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
index 24a5aa3d3..b51caf142 100644
--- a/bot/modules/speedtest.py
+++ b/bot/modules/speedtest.py
@@ -4,10 +4,9 @@
from bot import dispatcher, AUTHORIZED_CHATS
from bot.helper.telegram_helper.bot_commands import BotCommands
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
-from telegram.ext import CallbackContext, Filters, run_async, CommandHandler
+from telegram.ext import CallbackContext, Filters, CommandHandler
-@run_async
def speedtst(update, context):
message = update.effective_message
ed_msg = message.reply_text("Running Speed Test . . . 💨")
@@ -42,6 +41,6 @@ def speed_convert(size):
SPEED_HANDLER = CommandHandler(BotCommands.SpeedCommand, speedtst,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(SPEED_HANDLER)
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index f869c1ba9..ffd7d9206 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from telegram import Bot, Update
from bot import Interval, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
from bot.helper.ext_utils.bot_utils import setInterval
@@ -54,18 +54,17 @@ def _watch(bot: Bot, update, isTar=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-@run_async
+
def watchTar(update, context):
_watch(context.bot, update, True)
-
def watch(update, context):
_watch(context.bot, update)
mirror_handler = CommandHandler(BotCommands.WatchCommand, watch,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
tar_mirror_handler = CommandHandler(BotCommands.TarWatchCommand, watchTar,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
diff --git a/requirements.txt b/requirements.txt
index a635795d1..45d59de63 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
requests
progress
psutil
-python-telegram-bot==12.6.1
+python-telegram-bot==13.4.1
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
google-auth-oauthlib>=0.4.1,<0.10.0
@@ -12,8 +12,7 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram==0.18.0
TgCrypto>=1.1.1,<1.1.10
-psycopg2-binary
-git+https://github.com/yt-dlp/yt-dlp
+https://github.com/yt-dlp/yt-dlp/archive/master.zip
lxml
telegraph
appdirs
From 5c40667b79cdf2c1d41c4ac1787b91b67107fff9 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 15 Mar 2021 11:29:01 +0530
Subject: [PATCH 141/190] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6fe5ae0b1..0a5d61073 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
# Another Important Thing, Always Give Credit. These People/Devs Have Worked Really Hard Without Incentive To Make These Awesome Bots. Give Them Respect.
-All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto And Some Unkown Users Of Git. #Check Credits Below For Full Credit Details.
+All The Credits To Real Owners Who Made And Modified This Amazing Bot. Sir lzzy12,Sir ZeroCool Aka Jaskaran ,Sir Magneto, Nenokkadine And Some Unkown Users Of Git. #Check Credits Below For Full Credit Details.
I Am Just Doing The Modification For Personal Use.
From e6ed929d4fb2e841a08dc9ef41d91d71c4be9a9d Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 27 Mar 2021 22:51:41 +0530
Subject: [PATCH 142/190] Revert "Update PTB and Make YTDL use Aria2c for
HLS/DASH"
---
bot/__main__.py | 20 ++++++++++++-------
.../youtube_dl_download_helper.py | 4 +---
bot/helper/telegram_helper/filters.py | 10 +++++-----
bot/modules/authorize.py | 7 +++++--
bot/modules/cancel_mirror.py | 8 +++++---
bot/modules/delete.py | 5 +++--
bot/modules/list.py | 5 +++--
bot/modules/mirror.py | 13 ++++++++----
bot/modules/mirror_status.py | 5 +++--
bot/modules/speedtest.py | 5 +++--
bot/modules/watch.py | 9 +++++----
requirements.txt | 5 +++--
12 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 52b9efc7a..c39668a48 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -6,7 +6,7 @@
from sys import executable
import time
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from bot import dispatcher, updater, botStartTime
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
@@ -16,6 +16,7 @@
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest
+@run_async
def stats(update, context):
currentTime = get_readable_time((time.time() - botStartTime))
total, used, free = shutil.disk_usage('.')
@@ -39,6 +40,7 @@ def stats(update, context):
sendMessage(stats, context.bot, update)
+@run_async
def start(update, context):
start_string = f'''
This is a bot which can mirror all your links to Google drive!
@@ -47,6 +49,7 @@ def start(update, context):
sendMessage(start_string, context.bot, update)
+@run_async
def restart(update, context):
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
# Save restart message object in order to reply to it after restarting
@@ -56,6 +59,7 @@ def restart(update, context):
execl(executable, executable, "-m", "bot")
+@run_async
def ping(update, context):
start_time = int(round(time.time() * 1000))
reply = sendMessage("Starting Ping", context.bot, update)
@@ -63,10 +67,12 @@ def ping(update, context):
editMessage(f'{end_time - start_time} ms', reply)
+@run_async
def log(update, context):
sendLogFile(context.bot, update)
+@run_async
def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
@@ -109,16 +115,16 @@ def main():
remove('restart.pickle')
start_handler = CommandHandler(BotCommands.StartCommand, start,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
ping_handler = CommandHandler(BotCommands.PingCommand, ping,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
restart_handler = CommandHandler(BotCommands.RestartCommand, restart,
- filters=CustomFilters.owner_filter| CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.owner_filter| CustomFilters.authorized_user)
help_handler = CommandHandler(BotCommands.HelpCommand,
- bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
stats_handler = CommandHandler(BotCommands.StatsCommand,
- stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
- log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter, run_async=True)
+ stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(ping_handler)
dispatcher.add_handler(restart_handler)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 7b80c7753..6363c8a62 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -43,9 +43,7 @@ def __init__(self, listener):
self.opts = {
'progress_hooks': [self.__onDownloadProgress],
'logger': MyLogger(self),
- 'usenetrc': True,
- 'external_downloader' : 'aria2c',
- 'allow_multiple_audio_streams' : True
+ 'usenetrc': True
}
self.__download_speed = 0
self.download_speed_readable = ''
diff --git a/bot/helper/telegram_helper/filters.py b/bot/helper/telegram_helper/filters.py
index b40b0217f..3cd3c9363 100644
--- a/bot/helper/telegram_helper/filters.py
+++ b/bot/helper/telegram_helper/filters.py
@@ -1,29 +1,29 @@
-from telegram.ext import MessageFilter
+from telegram.ext import BaseFilter
from telegram import Message
from bot import AUTHORIZED_CHATS, OWNER_ID, download_dict, download_dict_lock
class CustomFilters:
- class _OwnerFilter(MessageFilter):
+ class _OwnerFilter(BaseFilter):
def filter(self, message):
return bool(message.from_user.id == OWNER_ID)
owner_filter = _OwnerFilter()
- class _AuthorizedUserFilter(MessageFilter):
+ class _AuthorizedUserFilter(BaseFilter):
def filter(self, message):
id = message.from_user.id
return bool(id in AUTHORIZED_CHATS or id == OWNER_ID)
authorized_user = _AuthorizedUserFilter()
- class _AuthorizedChat(MessageFilter):
+ class _AuthorizedChat(BaseFilter):
def filter(self, message):
return bool(message.chat.id in AUTHORIZED_CHATS)
authorized_chat = _AuthorizedChat()
- class _MirrorOwner(MessageFilter):
+ class _MirrorOwner(BaseFilter):
def filter(self, message: Message):
user_id = message.from_user.id
if user_id == OWNER_ID:
diff --git a/bot/modules/authorize.py b/bot/modules/authorize.py
index 92679f429..fedb4d1ac 100644
--- a/bot/modules/authorize.py
+++ b/bot/modules/authorize.py
@@ -1,4 +1,5 @@
from bot.helper.telegram_helper.message_utils import sendMessage
+from telegram.ext import run_async
from bot import AUTHORIZED_CHATS, dispatcher
from telegram.ext import CommandHandler
from bot.helper.telegram_helper.filters import CustomFilters
@@ -7,6 +8,7 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
+@run_async
def authorize(update,context):
reply_message = update.message.reply_to_message
msg = ''
@@ -32,6 +34,7 @@ def authorize(update,context):
sendMessage(msg, context.bot, update)
+@run_async
def unauthorize(update,context):
reply_message = update.message.reply_to_message
if reply_message is None:
@@ -58,9 +61,9 @@ def unauthorize(update,context):
authorize_handler = CommandHandler(command=BotCommands.AuthorizeCommand, callback=authorize,
- filters=CustomFilters.owner_filter & Filters.group, run_async=True)
+ filters=CustomFilters.owner_filter & Filters.group)
unauthorize_handler = CommandHandler(command=BotCommands.UnAuthorizeCommand, callback=unauthorize,
- filters=CustomFilters.owner_filter & Filters.group, run_async=True)
+ filters=CustomFilters.owner_filter & Filters.group)
dispatcher.add_handler(authorize_handler)
dispatcher.add_handler(unauthorize_handler)
diff --git a/bot/modules/cancel_mirror.py b/bot/modules/cancel_mirror.py
index 8d0d3a671..a4d2d7415 100644
--- a/bot/modules/cancel_mirror.py
+++ b/bot/modules/cancel_mirror.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from bot import download_dict, dispatcher, download_dict_lock, DOWNLOAD_DIR
from bot.helper.ext_utils.fs_utils import clean_download
@@ -10,6 +10,7 @@
from bot.helper.ext_utils.bot_utils import getDownloadByGid, MirrorStatus
+@run_async
def cancel_mirror(update, context):
args = update.message.text.split(" ", maxsplit=1)
mirror_message = None
@@ -50,6 +51,7 @@ def cancel_mirror(update, context):
clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/')
+@run_async
def cancel_all(update, context):
with download_dict_lock:
count = 0
@@ -63,8 +65,8 @@ def cancel_all(update, context):
cancel_mirror_handler = CommandHandler(BotCommands.CancelMirror, cancel_mirror,
- filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True)
+ filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter)
cancel_all_handler = CommandHandler(BotCommands.CancelAllCommand, cancel_all,
- filters=CustomFilters.owner_filter, run_async=True)
+ filters=CustomFilters.owner_filter)
dispatcher.add_handler(cancel_all_handler)
dispatcher.add_handler(cancel_mirror_handler)
diff --git a/bot/modules/delete.py b/bot/modules/delete.py
index a7e95cc37..783d9fc2c 100644
--- a/bot/modules/delete.py
+++ b/bot/modules/delete.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
import threading
from telegram import Update
from bot import dispatcher, LOGGER
@@ -7,6 +7,7 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.mirror_utils.upload_utils import gdriveTools
+@run_async
def deletefile(update, context):
msg_args = update.message.text.split(None, 1)
msg = ''
@@ -25,5 +26,5 @@ def deletefile(update, context):
threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
delete_handler = CommandHandler(command=BotCommands.deleteCommand, callback=deletefile,
- filters=CustomFilters.owner_filter, run_async=True)
+ filters=CustomFilters.owner_filter)
dispatcher.add_handler(delete_handler)
\ No newline at end of file
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 81d0dd32e..0b15f0fdc 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -1,10 +1,11 @@
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot import LOGGER, dispatcher
from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup, editMessage
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
+@run_async
def list_drive(update,context):
try:
search = update.message.text.split(' ',maxsplit=1)[1]
@@ -22,5 +23,5 @@ def list_drive(update,context):
sendMessage('send a search key along with command', context.bot, update)
-list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(list_handler)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 04628435a..da053d2f2 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -1,5 +1,5 @@
import requests
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
@@ -272,22 +272,27 @@ def _mirror(bot, update, isTar=False, extract=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
+@run_async
def mirror(update, context):
_mirror(context.bot, update)
+
+@run_async
def tar_mirror(update, context):
_mirror(context.bot, update, True)
+
+@run_async
def unzip_mirror(update, context):
_mirror(context.bot, update, extract=True)
mirror_handler = CommandHandler(BotCommands.MirrorCommand, mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
tar_mirror_handler = CommandHandler(BotCommands.TarMirrorCommand, tar_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
unzip_mirror_handler = CommandHandler(BotCommands.UnzipMirrorCommand, unzip_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
dispatcher.add_handler(unzip_mirror_handler)
diff --git a/bot/modules/mirror_status.py b/bot/modules/mirror_status.py
index 482d17ad6..e4ae32494 100644
--- a/bot/modules/mirror_status.py
+++ b/bot/modules/mirror_status.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from bot import dispatcher, status_reply_dict, DOWNLOAD_STATUS_UPDATE_INTERVAL, status_reply_dict_lock
from bot.helper.telegram_helper.message_utils import *
from time import sleep
@@ -8,6 +8,7 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
import threading
+@run_async
def mirror_status(update,context):
message = get_readable_message()
if len(message) == 0:
@@ -25,5 +26,5 @@ def mirror_status(update,context):
mirror_status_handler = CommandHandler(BotCommands.StatusCommand, mirror_status,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_status_handler)
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
index b51caf142..24a5aa3d3 100644
--- a/bot/modules/speedtest.py
+++ b/bot/modules/speedtest.py
@@ -4,9 +4,10 @@
from bot import dispatcher, AUTHORIZED_CHATS
from bot.helper.telegram_helper.bot_commands import BotCommands
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
-from telegram.ext import CallbackContext, Filters, CommandHandler
+from telegram.ext import CallbackContext, Filters, run_async, CommandHandler
+@run_async
def speedtst(update, context):
message = update.effective_message
ed_msg = message.reply_text("Running Speed Test . . . 💨")
@@ -41,6 +42,6 @@ def speed_convert(size):
SPEED_HANDLER = CommandHandler(BotCommands.SpeedCommand, speedtst,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(SPEED_HANDLER)
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index ffd7d9206..f869c1ba9 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler
+from telegram.ext import CommandHandler, run_async
from telegram import Bot, Update
from bot import Interval, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
from bot.helper.ext_utils.bot_utils import setInterval
@@ -54,17 +54,18 @@ def _watch(bot: Bot, update, isTar=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-
+@run_async
def watchTar(update, context):
_watch(context.bot, update, True)
+
def watch(update, context):
_watch(context.bot, update)
mirror_handler = CommandHandler(BotCommands.WatchCommand, watch,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
tar_mirror_handler = CommandHandler(BotCommands.TarWatchCommand, watchTar,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
diff --git a/requirements.txt b/requirements.txt
index 45d59de63..a635795d1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
requests
progress
psutil
-python-telegram-bot==13.4.1
+python-telegram-bot==12.6.1
google-api-python-client>=1.7.11,<1.7.20
google-auth-httplib2>=0.0.3,<0.1.0
google-auth-oauthlib>=0.4.1,<0.10.0
@@ -12,7 +12,8 @@ python-magic
beautifulsoup4>=4.8.2,<4.8.10
Pyrogram==0.18.0
TgCrypto>=1.1.1,<1.1.10
-https://github.com/yt-dlp/yt-dlp/archive/master.zip
+psycopg2-binary
+git+https://github.com/yt-dlp/yt-dlp
lxml
telegraph
appdirs
From 8947d89d94ebb675d612e35df4474546360d70dd Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 28 Mar 2021 13:29:06 +0530
Subject: [PATCH 143/190] Update About Mega Downloads
---
README.md | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 0a5d61073..1ae4c68ef 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,7 @@
5. Added Custom User Agent ,Peer Agent..Transmission For Now.
# Important - About Mega Downloads.
-1. There Is No Max Size Limit For Mega Folder Or File
-2. If A Folder Fails To Download , Import It Into Your Mega Account And Create A Fresh Sharing Link. Weird But Works.
-3. If Mega Download Is Running, Don't Put Torrents Or Direct Link Mirror With It , Crashes Sometime.
-4. We Recommand One Download At Time , If You Have Multicore Instance Or Vps You Can Try Multiple Download At A Time.
+All Fixed , No Issues Whatsoever.
# [A Guide On How To Customise Bot Further for Personal Use.](https://github.com/iamLiquidX/MirrorX/blob/master/modificaton.md#a-guide-on-how-to-customise-bot-further-for-personal-use)
### Added A Small Guide Which Has The Following :-
From d0250198d728fa7e3cd6e628621655cfb761df00 Mon Sep 17 00:00:00 2001
From: KenHV
Date: Wed, 3 Mar 2021 22:41:45 +0530
Subject: [PATCH 144/190] treewide: prepare for dependency updates
this commit is a squash of the following:
- filters: inherit from MessageFilter
- replace @run_async decorator with Dispatcher.run_async
- start/restart: remove pickle usage
- start/restart: update status message if bot restarts
- store pyrogram session in memory instead of making a new one everytime
Signed-off-by: KenHV
---
bot/__init__.py | 5 +-
bot/__main__.py | 51 +++++++++----------
.../download_utils/telegram_downloader.py | 10 +---
bot/helper/telegram_helper/filters.py | 10 ++--
bot/modules/authorize.py | 7 +--
bot/modules/cancel_mirror.py | 8 ++-
bot/modules/clone.py | 5 +-
bot/modules/delete.py | 7 ++-
bot/modules/list.py | 5 +-
bot/modules/mirror.py | 11 ++--
bot/modules/mirror_status.py | 5 +-
bot/modules/watch.py | 7 ++-
12 files changed, 55 insertions(+), 76 deletions(-)
diff --git a/bot/__init__.py b/bot/__init__.py
index a7881ae80..43632cb5e 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -95,8 +95,7 @@ def getConfig(name: str):
exit(1)
LOGGER.info("Generating USER_SESSION_STRING")
-with Client(':memory:', api_id=int(TELEGRAM_API), api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN) as app:
- USER_SESSION_STRING = app.export_session_string()
+app = Client(':memory:', api_id=int(TELEGRAM_API), api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN)
#Generate Telegraph Token
sname = ''.join(random.SystemRandom().choices(string.ascii_letters, k=8))
@@ -194,6 +193,6 @@ def getConfig(name: str):
SHORTENER = None
SHORTENER_API = None
-updater = tg.Updater(token=BOT_TOKEN,use_context=True)
+updater = tg.Updater(token=BOT_TOKEN)
bot = updater.bot
dispatcher = updater.dispatcher
diff --git a/bot/__main__.py b/bot/__main__.py
index 1a9352d41..9fd9efd3f 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -1,13 +1,12 @@
+import os
import shutil, psutil
import signal
-import pickle
-from os import execl, path, remove
from sys import executable
import time
-from telegram.ext import CommandHandler, run_async
-from bot import dispatcher, updater, botStartTime
+from telegram.ext import CommandHandler
+from bot import bot, dispatcher, updater, botStartTime
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.message_utils import *
@@ -15,8 +14,10 @@
from .helper.telegram_helper.filters import CustomFilters
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete
+from pyrogram import idle
+from bot import app
+
-@run_async
def stats(update, context):
currentTime = get_readable_time((time.time() - botStartTime))
total, used, free = shutil.disk_usage('.')
@@ -40,7 +41,6 @@ def stats(update, context):
sendMessage(stats, context.bot, update)
-@run_async
def start(update, context):
start_string = f'''
This is a bot which can mirror all your links to Google drive!
@@ -49,17 +49,17 @@ def start(update, context):
sendMessage(start_string, context.bot, update)
-@run_async
def restart(update, context):
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
- # Save restart message object in order to reply to it after restarting
+ # Save restart message ID and chat ID in order to edit it after restarting
+ with open(".restartmsg", "w") as f:
+ f.truncate(0)
+ f.write(f"{restart_message.chat.id}\n{restart_message.message_id}\n")
fs_utils.clean_all()
- with open('restart.pickle', 'wb') as status:
- pickle.dump(restart_message, status)
- execl(executable, executable, "-m", "bot")
+ args = [executable, "-m", "bot"]
+ os.execle(executable, *args, os.environ)
-@run_async
def ping(update, context):
start_time = int(round(time.time() * 1000))
reply = sendMessage("Starting Ping", context.bot, update)
@@ -67,12 +67,10 @@ def ping(update, context):
editMessage(f'{end_time - start_time} ms', reply)
-@run_async
def log(update, context):
sendLogFile(context.bot, update)
-@run_async
def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
@@ -106,23 +104,23 @@ def bot_help(update, context):
def main():
fs_utils.start_cleanup()
# Check if the bot is restarting
- if path.exists('restart.pickle'):
- with open('restart.pickle', 'rb') as status:
- restart_message = pickle.load(status)
- restart_message.edit_text("Restarted Successfully!")
- remove('restart.pickle')
+ if os.path.isfile(".restartmsg"):
+ with open(".restartmsg") as f:
+ chat_id, msg_id = map(int, f)
+ bot.edit_message_text("Restarted successfully!", chat_id, msg_id)
+ os.remove(".restartmsg")
start_handler = CommandHandler(BotCommands.StartCommand, start,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
ping_handler = CommandHandler(BotCommands.PingCommand, ping,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
restart_handler = CommandHandler(BotCommands.RestartCommand, restart,
- filters=CustomFilters.owner_filter)
+ filters=CustomFilters.owner_filter, run_async=True)
help_handler = CommandHandler(BotCommands.HelpCommand,
- bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
stats_handler = CommandHandler(BotCommands.StatsCommand,
- stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
- log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
+ stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(ping_handler)
dispatcher.add_handler(restart_handler)
@@ -133,5 +131,6 @@ def main():
LOGGER.info("Bot Started!")
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
-
+app.start()
main()
+idle()
diff --git a/bot/helper/mirror_utils/download_utils/telegram_downloader.py b/bot/helper/mirror_utils/download_utils/telegram_downloader.py
index 7b7b89b0e..59a926d9f 100644
--- a/bot/helper/mirror_utils/download_utils/telegram_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/telegram_downloader.py
@@ -2,10 +2,7 @@
import threading
import time
-from pyrogram import Client
-
-from bot import LOGGER, download_dict, download_dict_lock, TELEGRAM_API, \
- TELEGRAM_HASH, USER_SESSION_STRING
+from bot import LOGGER, download_dict, download_dict_lock, app
from .download_helper import DownloadHelper
from ..status_utils.telegram_download_status import TelegramDownloadStatus
@@ -23,10 +20,7 @@ def __init__(self, listener):
self.__name = ""
self.__gid = ''
self.__start_time = time.time()
- self.__user_bot = Client(api_id=TELEGRAM_API,
- api_hash=TELEGRAM_HASH,
- session_name=USER_SESSION_STRING)
- self.__user_bot.start()
+ self.__user_bot = app
self.__is_cancelled = False
@property
diff --git a/bot/helper/telegram_helper/filters.py b/bot/helper/telegram_helper/filters.py
index 3cd3c9363..b40b0217f 100644
--- a/bot/helper/telegram_helper/filters.py
+++ b/bot/helper/telegram_helper/filters.py
@@ -1,29 +1,29 @@
-from telegram.ext import BaseFilter
+from telegram.ext import MessageFilter
from telegram import Message
from bot import AUTHORIZED_CHATS, OWNER_ID, download_dict, download_dict_lock
class CustomFilters:
- class _OwnerFilter(BaseFilter):
+ class _OwnerFilter(MessageFilter):
def filter(self, message):
return bool(message.from_user.id == OWNER_ID)
owner_filter = _OwnerFilter()
- class _AuthorizedUserFilter(BaseFilter):
+ class _AuthorizedUserFilter(MessageFilter):
def filter(self, message):
id = message.from_user.id
return bool(id in AUTHORIZED_CHATS or id == OWNER_ID)
authorized_user = _AuthorizedUserFilter()
- class _AuthorizedChat(BaseFilter):
+ class _AuthorizedChat(MessageFilter):
def filter(self, message):
return bool(message.chat.id in AUTHORIZED_CHATS)
authorized_chat = _AuthorizedChat()
- class _MirrorOwner(BaseFilter):
+ class _MirrorOwner(MessageFilter):
def filter(self, message: Message):
user_id = message.from_user.id
if user_id == OWNER_ID:
diff --git a/bot/modules/authorize.py b/bot/modules/authorize.py
index fedb4d1ac..92679f429 100644
--- a/bot/modules/authorize.py
+++ b/bot/modules/authorize.py
@@ -1,5 +1,4 @@
from bot.helper.telegram_helper.message_utils import sendMessage
-from telegram.ext import run_async
from bot import AUTHORIZED_CHATS, dispatcher
from telegram.ext import CommandHandler
from bot.helper.telegram_helper.filters import CustomFilters
@@ -8,7 +7,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
-@run_async
def authorize(update,context):
reply_message = update.message.reply_to_message
msg = ''
@@ -34,7 +32,6 @@ def authorize(update,context):
sendMessage(msg, context.bot, update)
-@run_async
def unauthorize(update,context):
reply_message = update.message.reply_to_message
if reply_message is None:
@@ -61,9 +58,9 @@ def unauthorize(update,context):
authorize_handler = CommandHandler(command=BotCommands.AuthorizeCommand, callback=authorize,
- filters=CustomFilters.owner_filter & Filters.group)
+ filters=CustomFilters.owner_filter & Filters.group, run_async=True)
unauthorize_handler = CommandHandler(command=BotCommands.UnAuthorizeCommand, callback=unauthorize,
- filters=CustomFilters.owner_filter & Filters.group)
+ filters=CustomFilters.owner_filter & Filters.group, run_async=True)
dispatcher.add_handler(authorize_handler)
dispatcher.add_handler(unauthorize_handler)
diff --git a/bot/modules/cancel_mirror.py b/bot/modules/cancel_mirror.py
index a4d2d7415..8d0d3a671 100644
--- a/bot/modules/cancel_mirror.py
+++ b/bot/modules/cancel_mirror.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot import download_dict, dispatcher, download_dict_lock, DOWNLOAD_DIR
from bot.helper.ext_utils.fs_utils import clean_download
@@ -10,7 +10,6 @@
from bot.helper.ext_utils.bot_utils import getDownloadByGid, MirrorStatus
-@run_async
def cancel_mirror(update, context):
args = update.message.text.split(" ", maxsplit=1)
mirror_message = None
@@ -51,7 +50,6 @@ def cancel_mirror(update, context):
clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/')
-@run_async
def cancel_all(update, context):
with download_dict_lock:
count = 0
@@ -65,8 +63,8 @@ def cancel_all(update, context):
cancel_mirror_handler = CommandHandler(BotCommands.CancelMirror, cancel_mirror,
- filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter)
+ filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True)
cancel_all_handler = CommandHandler(BotCommands.CancelAllCommand, cancel_all,
- filters=CustomFilters.owner_filter)
+ filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(cancel_all_handler)
dispatcher.add_handler(cancel_mirror_handler)
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index 32cf998c7..9facc0b7d 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -7,7 +7,6 @@
from bot import dispatcher
-@new_thread
def cloneNode(update,context):
args = update.message.text.split(" ",maxsplit=1)
if len(args) > 1:
@@ -23,5 +22,5 @@ def cloneNode(update,context):
else:
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
-clone_handler = CommandHandler(BotCommands.CloneCommand,cloneNode,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
-dispatcher.add_handler(clone_handler)
\ No newline at end of file
+clone_handler = CommandHandler(BotCommands.CloneCommand,cloneNode,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+dispatcher.add_handler(clone_handler)
diff --git a/bot/modules/delete.py b/bot/modules/delete.py
index 783d9fc2c..eb4d263a1 100644
--- a/bot/modules/delete.py
+++ b/bot/modules/delete.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
import threading
from telegram import Update
from bot import dispatcher, LOGGER
@@ -7,7 +7,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.mirror_utils.upload_utils import gdriveTools
-@run_async
def deletefile(update, context):
msg_args = update.message.text.split(None, 1)
msg = ''
@@ -26,5 +25,5 @@ def deletefile(update, context):
threading.Thread(target=auto_delete_message, args=(context.bot, update.message, reply_message)).start()
delete_handler = CommandHandler(command=BotCommands.deleteCommand, callback=deletefile,
- filters=CustomFilters.owner_filter)
-dispatcher.add_handler(delete_handler)
\ No newline at end of file
+ filters=CustomFilters.owner_filter, run_async=True)
+dispatcher.add_handler(delete_handler)
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 0b15f0fdc..81d0dd32e 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -1,11 +1,10 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot import LOGGER, dispatcher
from bot.helper.telegram_helper.message_utils import sendMessage, sendMarkup, editMessage
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
-@run_async
def list_drive(update,context):
try:
search = update.message.text.split(' ',maxsplit=1)[1]
@@ -23,5 +22,5 @@ def list_drive(update,context):
sendMessage('send a search key along with command', context.bot, update)
-list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(list_handler)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index a5b6199ec..06407e20c 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -1,5 +1,5 @@
import requests
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
@@ -272,27 +272,24 @@ def _mirror(bot, update, isTar=False, extract=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-@run_async
def mirror(update, context):
_mirror(context.bot, update)
-@run_async
def tar_mirror(update, context):
_mirror(context.bot, update, True)
-@run_async
def unzip_mirror(update, context):
_mirror(context.bot, update, extract=True)
mirror_handler = CommandHandler(BotCommands.MirrorCommand, mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
tar_mirror_handler = CommandHandler(BotCommands.TarMirrorCommand, tar_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
unzip_mirror_handler = CommandHandler(BotCommands.UnzipMirrorCommand, unzip_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
dispatcher.add_handler(unzip_mirror_handler)
diff --git a/bot/modules/mirror_status.py b/bot/modules/mirror_status.py
index e4ae32494..482d17ad6 100644
--- a/bot/modules/mirror_status.py
+++ b/bot/modules/mirror_status.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from bot import dispatcher, status_reply_dict, DOWNLOAD_STATUS_UPDATE_INTERVAL, status_reply_dict_lock
from bot.helper.telegram_helper.message_utils import *
from time import sleep
@@ -8,7 +8,6 @@
from bot.helper.telegram_helper.bot_commands import BotCommands
import threading
-@run_async
def mirror_status(update,context):
message = get_readable_message()
if len(message) == 0:
@@ -26,5 +25,5 @@ def mirror_status(update,context):
mirror_status_handler = CommandHandler(BotCommands.StatusCommand, mirror_status,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_status_handler)
diff --git a/bot/modules/watch.py b/bot/modules/watch.py
index f869c1ba9..d4139d606 100644
--- a/bot/modules/watch.py
+++ b/bot/modules/watch.py
@@ -1,4 +1,4 @@
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from telegram import Bot, Update
from bot import Interval, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
from bot.helper.ext_utils.bot_utils import setInterval
@@ -54,7 +54,6 @@ def _watch(bot: Bot, update, isTar=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-@run_async
def watchTar(update, context):
_watch(context.bot, update, True)
@@ -64,8 +63,8 @@ def watch(update, context):
mirror_handler = CommandHandler(BotCommands.WatchCommand, watch,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
tar_mirror_handler = CommandHandler(BotCommands.TarWatchCommand, watchTar,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
From 721582f759017350f473a32291602572026b49e1 Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sat, 10 Apr 2021 17:14:12 +0530
Subject: [PATCH 145/190] requirements: relax all version constraints
Signed-off-by: KenHV
---
requirements.txt | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 65bc7a86f..1a207e983 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,17 @@
-requests
+appdirs
+aria2p
+beautifulsoup4
+google-api-python-client
+google-auth-httplib2
+google-auth-oauthlib
+lxml
psutil
-python-telegram-bot==12.6.1
-google-api-python-client>=1.7.11,<1.7.20
-google-auth-httplib2>=0.0.3,<0.1.0
-google-auth-oauthlib>=0.4.1,<0.10.0
-aria2p>=0.9.0,<0.15.0
-python-dotenv>=0.10
-tenacity>=6.0.0
+Pyrogram
+python-dotenv
python-magic
-beautifulsoup4>=4.8.2,<4.8.10
-Pyrogram==0.18.0
-TgCrypto>=1.1.1,<1.1.10
-git+https://gitlab.com/magneto261290/youtube-dl
-lxml
+python-telegram-bot
+requests
telegraph
-appdirs
+tenacity
+TgCrypto
+youtube_dl
From 73663883e8713e2fa1b140f5a758ab0bff05cd70 Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sat, 10 Apr 2021 17:16:55 +0530
Subject: [PATCH 146/190] treewide: upgrade codebase to 3.9+ syntax
Signed-off-by: KenHV
---
add_to_team_drive.py | 5 ++---
bot/__main__.py | 2 +-
.../download_utils/mega_downloader.py | 4 ++--
.../mirror_utils/upload_utils/gdriveTools.py | 16 ++++++++--------
bot/modules/mirror.py | 4 ++--
gen_sa_accounts.py | 10 +++++-----
6 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/add_to_team_drive.py b/add_to_team_drive.py
index 222cbe1b1..f461a127d 100644
--- a/add_to_team_drive.py
+++ b/add_to_team_drive.py
@@ -1,4 +1,3 @@
-from __future__ import print_function
from google.oauth2.service_account import Credentials
import googleapiclient.discovery, json, progress.bar, glob, sys, argparse, time
from google_auth_oauthlib.flow import InstalledAppFlow
@@ -23,7 +22,7 @@
credentials = glob.glob(args.credentials)
try:
- open(credentials[0], 'r')
+ open(credentials[0])
print('>> Found credentials.')
except IndexError:
print('>> No credentials found.')
@@ -60,7 +59,7 @@
aa = glob.glob('%s/*.json' % acc_dir)
pbar = progress.bar.Bar("Readying accounts", max=len(aa))
for i in aa:
- ce = json.loads(open(i, 'r').read())['client_email']
+ ce = json.loads(open(i).read())['client_email']
batch.add(drive.permissions().create(fileId=did, supportsAllDrives=True, body={
"role": "fileOrganizer",
"type": "user",
diff --git a/bot/__main__.py b/bot/__main__.py
index 9fd9efd3f..8f82ec4de 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -19,7 +19,7 @@
def stats(update, context):
- currentTime = get_readable_time((time.time() - botStartTime))
+ currentTime = get_readable_time(time.time() - botStartTime)
total, used, free = shutil.disk_usage('.')
total = get_readable_file_size(total)
used = get_readable_file_size(used)
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 87f1009a7..4ecab1f3b 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -29,7 +29,7 @@ def __init__(self, continue_event: threading.Event, listener):
self.__size = 0
self.error = None
self.gid = ""
- super(MegaAppListener, self).__init__()
+ super().__init__()
@property
def speed(self):
@@ -56,7 +56,7 @@ def downloaded_bytes(self):
return self.__bytes_transferred
def onRequestStart(self, api, request):
- LOGGER.info('Request start ({})'.format(request))
+ LOGGER.info(f'Request start ({request})')
def onRequestFinish(self, api, request, error):
LOGGER.info('Mega Request finished ({}); Result: {}'
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 88da6973d..f297d2f99 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -324,14 +324,14 @@ def clone(self, link):
durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
- surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
+ surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text
buttons.buildbutton("⚡Drive Link⚡", surl)
else:
buttons.buildbutton("⚡Drive Link⚡", durl)
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
buttons.buildbutton("💥Index Link💥", siurl)
else:
buttons.buildbutton("💥Index Link💥", url)
@@ -347,7 +347,7 @@ def clone(self, link):
durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id"))
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
- surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
+ surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text
buttons.buildbutton("⚡Drive Link⚡", surl)
else:
buttons.buildbutton("⚡Drive Link⚡", durl)
@@ -358,7 +358,7 @@ def clone(self, link):
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
buttons.buildbutton("💥Index Link💥", siurl)
else:
buttons.buildbutton("💥Index Link💥", url)
@@ -516,14 +516,14 @@ def drive_list(self, fileName):
furl = f"https://drive.google.com/drive/folders/{file.get('id')}"
msg += f"⁍{file.get('name')}
(folder📁)
"
if SHORTENER is not None and SHORTENER_API is not None:
- sfurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text
+ sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
else:
msg += f"Drive Link"
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
msg += f' | Index Link'
else:
msg += f' | Index Link'
@@ -531,14 +531,14 @@ def drive_list(self, fileName):
furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download"
msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
"
if SHORTENER is not None and SHORTENER_API is not None:
- sfurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text
+ sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
else:
msg += f"Drive Link"
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
msg += f' | Index Link'
else:
msg += f' | Index Link'
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 06407e20c..f17a5d72e 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -149,7 +149,7 @@ def onUploadComplete(self, link: str, size):
msg = f'Filename : {download_dict[self.uid].name()}\nSize : {size}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
- surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
+ surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text').text
buttons.buildbutton("⚡Drive Link⚡", surl)
else:
buttons.buildbutton("⚡Drive Link⚡", link)
@@ -159,7 +159,7 @@ def onUploadComplete(self, link: str, size):
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text').text
buttons.buildbutton("💥Index Link💥", siurl)
else:
buttons.buildbutton("💥Index Link💥", share_url)
diff --git a/gen_sa_accounts.py b/gen_sa_accounts.py
index ff6f144b7..54c25c265 100644
--- a/gen_sa_accounts.py
+++ b/gen_sa_accounts.py
@@ -96,7 +96,7 @@ def _enable_services(service, projects, ste):
batch = service.new_batch_http_request(callback=_def_batch_resp)
for i in projects:
for j in ste:
- batch.add(service.services().enable(name='projects/%s/services/%s' % (i, j)))
+ batch.add(service.services().enable(name=f'projects/{i}/services/{j}'))
batch.execute()
@@ -134,7 +134,7 @@ def _create_sa_keys(iam, projects, path):
total_sas = _list_sas(iam, i)
for j in total_sas:
batch.add(iam.projects().serviceAccounts().keys().create(
- name='projects/%s/serviceAccounts/%s' % (i, j['uniqueId']),
+ name='projects/{}/serviceAccounts/{}'.format(i, j['uniqueId']),
body={
'privateKeyType': 'TYPE_GOOGLE_CREDENTIALS_FILE',
'keyAlgorithm': 'KEY_ALG_RSA_2048'
@@ -176,7 +176,7 @@ def serviceaccountfactory(
download_keys=None
):
selected_projects = []
- proj_id = loads(open(credentials, 'r').read())['installed']['project_id']
+ proj_id = loads(open(credentials).read())['installed']['project_id']
creds = None
if os.path.exists(token):
with open(token, 'rb') as t:
@@ -214,7 +214,7 @@ def serviceaccountfactory(
if list_sas:
return _list_sas(iam, list_sas)
if create_projects:
- print("creat projects: {}".format(create_projects))
+ print(f"creat projects: {create_projects}")
if create_projects > 0:
current_count = len(_get_projects(cloud))
if current_count + create_projects <= max_projects:
@@ -360,6 +360,6 @@ def serviceaccountfactory(
if resp:
print('Service accounts in %s (%d):' % (args.list_sas, len(resp)))
for i in resp:
- print(' %s (%s)' % (i['email'], i['uniqueId']))
+ print(' {} ({})'.format(i['email'], i['uniqueId']))
else:
print('No service accounts.')
From 4d34c568b59002daa935fa087963143b316f0ada Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sun, 4 Apr 2021 21:17:41 +0530
Subject: [PATCH 147/190] youtube_dl: fix geo bypass for hotstar and sonyliv
the previous syntax was not the proper way to check
for a substring in a string.
Signed-off-by: KenHV
---
.../mirror_utils/download_utils/youtube_dl_download_helper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index 3fc6507aa..6591b582e 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -102,7 +102,7 @@ def onDownloadError(self, error):
self.__listener.onDownloadError(error)
def extractMetaData(self, link, qual, name):
- if 'hotstar' or 'sonyliv' in link:
+ if "hotstar" in link or "sonyliv" in link:
self.opts['geo_bypass_country'] = 'IN'
with YoutubeDL(self.opts) as ydl:
From 211666af2ca63c8df2efa610c288798f43d7d4dd Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sat, 10 Apr 2021 17:00:26 +0530
Subject: [PATCH 148/190] init: fix trailing backslash check for DOWNLOAD_DIR
the previous check always results in True.
Signed-off-by: KenHV
---
bot/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/__init__.py b/bot/__init__.py
index 43632cb5e..3c614fb8b 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -83,7 +83,7 @@ def getConfig(name: str):
BOT_TOKEN = getConfig('BOT_TOKEN')
parent_id = getConfig('GDRIVE_FOLDER_ID')
DOWNLOAD_DIR = getConfig('DOWNLOAD_DIR')
- if DOWNLOAD_DIR[-1] != '/' or DOWNLOAD_DIR[-1] != '\\':
+ if not DOWNLOAD_DIR.endswith("/"):
DOWNLOAD_DIR = DOWNLOAD_DIR + '/'
DOWNLOAD_STATUS_UPDATE_INTERVAL = int(getConfig('DOWNLOAD_STATUS_UPDATE_INTERVAL'))
OWNER_ID = int(getConfig('OWNER_ID'))
From 1a3e44990b1517b5bb84b63d015f2353b44ed2b3 Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sat, 10 Apr 2021 17:54:43 +0530
Subject: [PATCH 149/190] restart: use execl() to spawn a new process
Signed-off-by: KenHV
---
bot/__main__.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index 8f82ec4de..8d9fffe78 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -56,8 +56,7 @@ def restart(update, context):
f.truncate(0)
f.write(f"{restart_message.chat.id}\n{restart_message.message_id}\n")
fs_utils.clean_all()
- args = [executable, "-m", "bot"]
- os.execle(executable, *args, os.environ)
+ os.execl(executable, executable, "-m", "bot")
def ping(update, context):
From 379aa417f3175221415194473923438d8e27f061 Mon Sep 17 00:00:00 2001
From: KenHV
Date: Sat, 10 Apr 2021 18:59:12 +0530
Subject: [PATCH 150/190] direct_link_generator: fix zippyshare
Signed-off-by: KenHV
---
.../download_utils/direct_link_generator.py | 44 +++++++++----------
requirements.txt | 1 +
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/bot/helper/mirror_utils/download_utils/direct_link_generator.py b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
index 84ea43a5b..91b206add 100644
--- a/bot/helper/mirror_utils/download_utils/direct_link_generator.py
+++ b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
@@ -16,6 +16,7 @@
import requests
from bs4 import BeautifulSoup
+from js2py import EvalJs
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
@@ -41,29 +42,28 @@ def direct_link_generator(link: str):
def zippy_share(url: str) -> str:
- """ ZippyShare direct links generator
- Based on https://github.com/LameLemon/ziggy"""
- dl_url = ''
+ link = re.findall("https:/.(.*?).zippyshare", url)[0]
+ response_content = (requests.get(url)).content
+ bs_obj = BeautifulSoup(response_content, "lxml")
+
try:
- link = re.findall(r'\bhttps?://.*zippyshare\.com\S+', url)[0]
- except IndexError:
- raise DirectDownloadLinkException("`No ZippyShare links found`\n")
- session = requests.Session()
- base_url = re.search('http.+.com', link).group()
- response = session.get(link)
- page_soup = BeautifulSoup(response.content, "lxml")
- scripts = page_soup.find_all("script", {"type": "text/javascript"})
- for script in scripts:
- if "getElementById('dlbutton')" in script.text:
- url_raw = re.search(r'= (?P\".+\" \+ (?P
-Here Is The Things To Get You Started.👇
+Here Are Some Things To Get You Started.👇
## 👉[All The Feature Of This Bot Or What This Bot Can Do For You.](https://github.com/iamLiquidX/MirrorX/wiki/Feature-Or-What-This-Bot-Can-Do)
From 9eb2d1362198a39000bbf2fb292f2a24c66b6d82 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 12 Apr 2021 14:50:52 +0000
Subject: [PATCH 154/190] Fixing The Conflicts For Pull Req. (#16)
* Preparing For Pull Req.
* Preparing For Pull Req.
* Preparing For Pull Req.
---
bot/__main__.py | 52 +++++++++++++++++++++----------------------
bot/modules/mirror.py | 15 +++++--------
requirements.txt | 23 ++++++++++---------
3 files changed, 43 insertions(+), 47 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index c39668a48..b9ece3e4a 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -1,13 +1,12 @@
+import os
import shutil, psutil
import signal
-import pickle
-from os import execl, path, remove
from sys import executable
import time
-from telegram.ext import CommandHandler, run_async
-from bot import dispatcher, updater, botStartTime
+from telegram.ext import CommandHandler
+from bot import bot, dispatcher, updater, botStartTime
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.message_utils import *
@@ -15,10 +14,12 @@
from .helper.telegram_helper.filters import CustomFilters
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest
+from pyrogram import idle
+from bot import app
+
-@run_async
def stats(update, context):
- currentTime = get_readable_time((time.time() - botStartTime))
+ currentTime = get_readable_time(time.time() - botStartTime)
total, used, free = shutil.disk_usage('.')
total = get_readable_file_size(total)
used = get_readable_file_size(used)
@@ -40,7 +41,6 @@ def stats(update, context):
sendMessage(stats, context.bot, update)
-@run_async
def start(update, context):
start_string = f'''
This is a bot which can mirror all your links to Google drive!
@@ -49,17 +49,16 @@ def start(update, context):
sendMessage(start_string, context.bot, update)
-@run_async
def restart(update, context):
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
- # Save restart message object in order to reply to it after restarting
+ # Save restart message ID and chat ID in order to edit it after restarting
+ with open(".restartmsg", "w") as f:
+ f.truncate(0)
+ f.write(f"{restart_message.chat.id}\n{restart_message.message_id}\n")
fs_utils.clean_all()
- with open('restart.pickle', 'wb') as status:
- pickle.dump(restart_message, status)
- execl(executable, executable, "-m", "bot")
+ os.execl(executable, executable, "-m", "bot")
-@run_async
def ping(update, context):
start_time = int(round(time.time() * 1000))
reply = sendMessage("Starting Ping", context.bot, update)
@@ -67,12 +66,10 @@ def ping(update, context):
editMessage(f'{end_time - start_time} ms', reply)
-@run_async
def log(update, context):
sendLogFile(context.bot, update)
-@run_async
def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
@@ -108,23 +105,23 @@ def bot_help(update, context):
def main():
fs_utils.start_cleanup()
# Check if the bot is restarting
- if path.exists('restart.pickle'):
- with open('restart.pickle', 'rb') as status:
- restart_message = pickle.load(status)
- restart_message.edit_text("Restarted Successfully!")
- remove('restart.pickle')
+ if os.path.isfile(".restartmsg"):
+ with open(".restartmsg") as f:
+ chat_id, msg_id = map(int, f)
+ bot.edit_message_text("Restarted successfully!", chat_id, msg_id)
+ os.remove(".restartmsg")
start_handler = CommandHandler(BotCommands.StartCommand, start,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
ping_handler = CommandHandler(BotCommands.PingCommand, ping,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
restart_handler = CommandHandler(BotCommands.RestartCommand, restart,
- filters=CustomFilters.owner_filter| CustomFilters.authorized_user)
+ filters=CustomFilters.owner_filter| CustomFilters.authorized_user, run_async=True)
help_handler = CommandHandler(BotCommands.HelpCommand,
- bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ bot_help, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
stats_handler = CommandHandler(BotCommands.StatsCommand,
- stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
- log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
+ stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+ log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter, run_async=True)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(ping_handler)
dispatcher.add_handler(restart_handler)
@@ -135,5 +132,6 @@ def main():
LOGGER.info("Bot Started!")
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
-
+app.start()
main()
+idle()
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index da053d2f2..faab3e0e0 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -1,5 +1,5 @@
import requests
-from telegram.ext import CommandHandler, run_async
+from telegram.ext import CommandHandler
from telegram import InlineKeyboardMarkup
from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
@@ -149,7 +149,7 @@ def onUploadComplete(self, link: str, size):
msg = f'Filename : {download_dict[self.uid].name()}\nSize : {size}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
- surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
+ surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text').text
buttons.buildbutton("💾Drive Link💾", surl)
else:
buttons.buildbutton("💾Drive Link💾", link)
@@ -159,7 +159,7 @@ def onUploadComplete(self, link: str, size):
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
- siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
+ siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text').text
buttons.buildbutton("🚀Index Link🚀", siurl)
else:
buttons.buildbutton("🚀Index Link🚀", share_url)
@@ -272,27 +272,24 @@ def _mirror(bot, update, isTar=False, extract=False):
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
-@run_async
def mirror(update, context):
_mirror(context.bot, update)
-@run_async
def tar_mirror(update, context):
_mirror(context.bot, update, True)
-@run_async
def unzip_mirror(update, context):
_mirror(context.bot, update, extract=True)
mirror_handler = CommandHandler(BotCommands.MirrorCommand, mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
tar_mirror_handler = CommandHandler(BotCommands.TarMirrorCommand, tar_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
unzip_mirror_handler = CommandHandler(BotCommands.UnzipMirrorCommand, unzip_mirror,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(mirror_handler)
dispatcher.add_handler(tar_mirror_handler)
dispatcher.add_handler(unzip_mirror_handler)
diff --git a/requirements.txt b/requirements.txt
index a635795d1..8bc466d1c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,21 +1,22 @@
requests
+appdirs
+aria2p
progress
psutil
-python-telegram-bot==12.6.1
-google-api-python-client>=1.7.11,<1.7.20
-google-auth-httplib2>=0.0.3,<0.1.0
-google-auth-oauthlib>=0.4.1,<0.10.0
-aria2p>=0.9.0,<0.15.0
-python-dotenv>=0.10
-tenacity>=6.0.0
+python-telegram-bot
+google-api-python-client
+google-auth-httplib2
+google-auth-oauthlib
+js2py
+python-dotenv
+tenacity
python-magic
-beautifulsoup4>=4.8.2,<4.8.10
-Pyrogram==0.18.0
-TgCrypto>=1.1.1,<1.1.10
+beautifulsoup4
+Pyrogram
+TgCrypto
psycopg2-binary
git+https://github.com/yt-dlp/yt-dlp
lxml
telegraph
-appdirs
speedtest-cli
messages
From 27c6b766adee5cf4e8a847e0f29ad2474387d950 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 12 Apr 2021 21:11:03 +0530
Subject: [PATCH 155/190] Update speedtest.py
---
bot/modules/speedtest.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
index 24a5aa3d3..72c887088 100644
--- a/bot/modules/speedtest.py
+++ b/bot/modules/speedtest.py
@@ -4,10 +4,10 @@
from bot import dispatcher, AUTHORIZED_CHATS
from bot.helper.telegram_helper.bot_commands import BotCommands
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
-from telegram.ext import CallbackContext, Filters, run_async, CommandHandler
+from telegram.ext import CallbackContext, Filters, CommandHandler
+
-@run_async
def speedtst(update, context):
message = update.effective_message
ed_msg = message.reply_text("Running Speed Test . . . 💨")
@@ -42,6 +42,6 @@ def speed_convert(size):
SPEED_HANDLER = CommandHandler(BotCommands.SpeedCommand, speedtst,
- filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
+ filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
dispatcher.add_handler(SPEED_HANDLER)
From f275e498573bb85006845157f3fd6c3890ba7d69 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Mon, 12 Apr 2021 21:25:42 +0530
Subject: [PATCH 156/190] Fixing Speedtest Module
---
bot/modules/speedtest.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/bot/modules/speedtest.py b/bot/modules/speedtest.py
index 72c887088..d597dc460 100644
--- a/bot/modules/speedtest.py
+++ b/bot/modules/speedtest.py
@@ -1,4 +1,5 @@
import speedtest
+import bot
from bot.helper.telegram_helper.filters import CustomFilters
from bot import dispatcher, AUTHORIZED_CHATS
From 69d38839410a3db7f5ea53942097e55461ce8169 Mon Sep 17 00:00:00 2001
From: TheFierceWarrior
Date: Mon, 13 Jul 2020 19:35:35 +0530
Subject: [PATCH 157/190] Fix Index URL encode problem
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 12 ++++++++----
bot/modules/mirror.py | 3 ++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index f297d2f99..32b72ed9c 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -329,7 +329,8 @@ def clone(self, link):
else:
buttons.buildbutton("⚡Drive Link⚡", durl)
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
+ url_path = requests.utils.quote(f'{meta.get("name")}')
+ url = f'{INDEX_URL}/{url_path}/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
buttons.buildbutton("💥Index Link💥", siurl)
@@ -356,7 +357,8 @@ def clone(self, link):
except TypeError:
pass
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ url_path = requests.utils.quote(f'{file.get("name")}')
+ url = f'{INDEX_URL}/{url_path}'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
buttons.buildbutton("💥Index Link💥", siurl)
@@ -521,7 +523,8 @@ def drive_list(self, fileName):
else:
msg += f"Drive Link"
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}/')
+ url_path = requests.utils.quote(f'{file.get("name")}')
+ url = f'{INDEX_URL}/{url_path}/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
msg += f' | Index Link'
@@ -536,7 +539,8 @@ def drive_list(self, fileName):
else:
msg += f"Drive Link"
if INDEX_URL is not None:
- url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
+ url_path = requests.utils.quote(f'{file.get("name")}')
+ url = f'{INDEX_URL}/{url_path}'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
msg += f' | Index Link'
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index f17a5d72e..08fce8082 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -155,7 +155,8 @@ def onUploadComplete(self, link: str, size):
buttons.buildbutton("⚡Drive Link⚡", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
- share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}')
+ url_path = requests.utils.quote(f'{download_dict[self.uid].name()}')
+ share_url = f'{INDEX_URL}/{url_path}'
if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
From 90079d3110ca00e3dd457a15490c3948925c0fae Mon Sep 17 00:00:00 2001
From: magneto261290
Date: Sun, 18 Apr 2021 18:41:43 +0530
Subject: [PATCH 158/190] Added support for password protected index links
---
README.md | 2 +-
bot/__main__.py | 2 +-
bot/modules/mirror.py | 16 ++++++++++++++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 6112a0524..e12a5702a 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ This project is heavily inspired from @out386 's telegram bot which is written i
- Shortener support
- Extract password protected files (It's not hack, you have to enter password for extracting. LOL)
-- For extracting password protected files and using custom filename see these examples :-
+- For extracting password protected files, using custom filename and download from password protected index links see these examples :-
> https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20
## Bot commands to be set in botfather
diff --git a/bot/__main__.py b/bot/__main__.py
index 8d9fffe78..0f8b20763 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -74,7 +74,7 @@ def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
-/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to google drive
+/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to google drive.\nPlzzz see this for full use of this command https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20
/{BotCommands.UnzipMirrorCommand} [download_url][magnet_link] : starts mirroring and if downloaded file is any archive , extracts it to google drive
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 08fce8082..91e6177a7 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -20,6 +20,7 @@
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.message_utils import *
from bot.helper.telegram_helper import button_build
+import urllib
import pathlib
import os
import subprocess
@@ -205,10 +206,12 @@ def onUploadError(self, error):
def _mirror(bot, update, isTar=False, extract=False):
- message_args = update.message.text.split(' ')
- name_args = update.message.text.split('|')
+ mesg = update.message.text.split('\n')
+ message_args = mesg[0].split(' ')
+ name_args = mesg[0].split('|')
try:
link = message_args[1]
+ print(link)
if link.startswith("|") or link.startswith("pswd: "):
link = ''
except IndexError:
@@ -220,6 +223,15 @@ def _mirror(bot, update, isTar=False, extract=False):
name = ''
except IndexError:
name = ''
+ try:
+ ussr = urllib.parse.quote(mesg[1], safe='')
+ pssw = urllib.parse.quote(mesg[2], safe='')
+ except:
+ ussr = ''
+ pssw = ''
+ if ussr != '' and pssw != '':
+ link = link.split("://", maxsplit=1)
+ link = f'{link[0]}://{ussr}:{pssw}@{link[1]}'
pswd = re.search('(?<=pswd: )(.*)', update.message.text)
if pswd is not None:
pswd = pswd.groups()
From e5e00596cf639eb572c356c2bd6a2d5fcac7fa24 Mon Sep 17 00:00:00 2001
From: Viswanath <65813999+nenokkadine@users.noreply.github.com>
Date: Thu, 22 Apr 2021 15:41:48 +0530
Subject: [PATCH 159/190] Use Aria Configuration file and Cleanup Dockerfile
(#18)
* - Clean Up Dockerfile
- Remove Useless Aria.bat
- Add Aria.conf
- Remove Useless aria.sh as Now aria command is an One-liner
- Fetch trackers Everytime
- Update YT-DLP Everytime when container restarted
* Classify config_sample.env
* Typo in Dockerfile
---
Dockerfile | 33 +++++++++++++++++---------------
aria.bat | 1 -
aria.conf | 48 +++++++++++++++++++++++++++++++++++++++++++++++
aria.sh | 10 ----------
config_sample.env | 27 ++++++++++++++++----------
start.sh | 6 +++++-
6 files changed, 88 insertions(+), 37 deletions(-)
delete mode 100644 aria.bat
create mode 100644 aria.conf
delete mode 100644 aria.sh
diff --git a/Dockerfile b/Dockerfile
index 91e48321a..45e756094 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,28 +1,31 @@
FROM iamliquidx/megasdk:latest
-WORKDIR /usr/src/app
-RUN chmod 777 /usr/src/app
+WORKDIR /app/
+
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
RUN apt-get -qq update && \
apt-get install -y software-properties-common && \
rm -rf /var/lib/apt/lists/* && \
apt-add-repository non-free && \
apt-get -qq update && \
- apt-get -qq install -y p7zip-full p7zip-rar aria2 curl pv jq ffmpeg locales python3-lxml && \
- apt-get purge -y software-properties-common
+ apt-get -qq install -y p7zip-full p7zip-rar aria2 curl wget pv jq ffmpeg locales python3-lxml && \
+ apt-get purge -y software-properties-common && \
+ locale-gen en_US.UTF-8 && \
+ chmod 777 /app/
-COPY requirements.txt .
-COPY extract /usr/local/bin
-COPY pextract /usr/local/bin
-RUN chmod +x /usr/local/bin/extract && chmod +x /usr/local/bin/pextract
-RUN pip3 install --no-cache-dir -r requirements.txt
-RUN locale-gen en_US.UTF-8
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
COPY . .
-COPY netrc /root/.netrc
-RUN chmod +x aria.sh
+RUN mv extract /usr/local/bin && \
+ mv pextract /usr/local/bin && \
+ chmod +x /usr/local/bin/extract && \
+ chmod +x /usr/local/bin/pextract && \
+ wget -q https://github.com/P3TERX/aria2.conf/raw/master/dht.dat -O /app/dht.dat && \
+ wget -q https://github.com/P3TERX/aria2.conf/raw/master/dht6.dat -O /app/dht6.dat && \
+ mkdir -p /root/ && \
+ mv netrc /root/.netrc && \
+ pip3 install --no-cache-dir -r requirements.txt
CMD ["bash","start.sh"]
diff --git a/aria.bat b/aria.bat
deleted file mode 100644
index 388080057..000000000
--- a/aria.bat
+++ /dev/null
@@ -1 +0,0 @@
-aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --max-connection-per-server=10 --rpc-max-request-size=1024M --seed-time=0.01 --min-split-size=10M --follow-torrent=mem --split=10 --daemon=true --allow-overwrite=true
diff --git a/aria.conf b/aria.conf
new file mode 100644
index 000000000..8c560ace0
--- /dev/null
+++ b/aria.conf
@@ -0,0 +1,48 @@
+# RPC
+enable-rpc=true
+rpc-allow-origin-all=true
+rpc-listen-all=true
+rpc-listen-port=6800
+rpc-max-request-size=1024M
+
+# Connection
+split=32
+max-connection-per-server=16
+check-certificate=false
+min-split-size=4M
+piece-length=1M
+lowest-speed-limit=0
+max-overall-download-limit=0
+disable-ipv6=true
+split=10
+
+# Aria
+daemon=true
+referer=*
+allow-overwrite=true
+file-allocation=prealloc
+auto-save-interval=1
+
+#BT
+listen-port=51413
+bt-max-peers=40
+bt-request-peer-speed-limit=10M
+max-overall-upload-limit=20M
+max-upload-limit=0
+seed-time=0.01
+bt-tracker-connect-timeout=600
+follow-torrent=mem
+bt-force-encryption=true
+bt-stop-timeout=600
+user-agent=Transmission 2.94
+peer-agent=Transmission 2.94
+peer-id-prefix=-TR2940-
+
+#DHT
+dht-listen-port=51513
+enable-dht=true
+enable-dht6=false
+dht-file-path=/app/dht.dat
+dht-file-path6=/app/dht6.dat
+dht-entry-point=dht.transmissionbt.com:6881
+dht-entry-point6=dht.transmissionbt.com:6881
diff --git a/aria.sh b/aria.sh
deleted file mode 100644
index bf3c89352..000000000
--- a/aria.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-export MAX_DOWNLOAD_SPEED=0
-tracker_list=$(curl -Ns https://raw.githubusercontent.com/iamLiquidX/trackerlistx/main/trackers.txt | awk '$1' | tr '\n' ',')
-export MAX_CONCURRENT_DOWNLOADS=4
-aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certificate=false\
- --max-connection-per-server=10 --rpc-max-request-size=1024M \
- --bt-tracker="[$tracker_list]" --bt-max-peers=0 --seed-time=0.01 --min-split-size=10M \
- --follow-torrent=mem --split=10 \
- --daemon=true --allow-overwrite=true --max-overall-download-limit=$MAX_DOWNLOAD_SPEED \
- --max-overall-upload-limit=1K --max-concurrent-downloads=$MAX_CONCURRENT_DOWNLOADS \
- --peer-id-prefix=-TR2770- --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 \
diff --git a/config_sample.env b/config_sample.env
index 1b0ebdedf..2545045df 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -1,28 +1,35 @@
#Remove this line before deploying
_____REMOVE_THIS_LINE_____=True
-# ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
-BOT_TOKEN = ""
-GDRIVE_FOLDER_ID = ""
+## Telegram
+BOT_TOKEN = "" # ENTER BOT TOKEN (Get your BOT_TOKEN by talking to @botfather)
OWNER_ID =
-DOWNLOAD_DIR = "/home/username/mirror-bot/downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
-IS_TEAM_DRIVE = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
-USE_SERVICE_ACCOUNTS = ""
-# Optional config
AUTHORIZED_CHATS = "" #Separated by space
+
+## Drive
+GDRIVE_FOLDER_ID = ""
+IS_TEAM_DRIVE = ""
INDEX_URL = ""
+DOWNLOAD_DIR = "/app/downloads"
+USE_SERVICE_ACCOUNTS = ""
+
+## Optional config
UPTOBOX_TOKEN = ""
-MEGA_API_KEY = ""
+
+MEGA_API_KEY = "" # Get this from https://mega.nz/sdk
MEGA_EMAIL_ID = ""
MEGA_PASSWORD = ""
-STOP_DUPLICATE_MIRROR = ""
BLOCK_MEGA_LINKS = ""
+
+STOP_DUPLICATE_MIRROR = ""
+
SHORTENER = ""
SHORTENER_API = ""
+
# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
# If you don't know what are below entries, simply leave them, Don't fill anything in them.
BUTTON_THREE_NAME = ""
@@ -30,4 +37,4 @@ BUTTON_THREE_URL = ""
BUTTON_FOUR_NAME = ""
BUTTON_FOUR_URL = ""
BUTTON_FIVE_NAME = ""
-BUTTON_FIVE_URL = ""
+BUTTON_FIVE_URL = ""
\ No newline at end of file
diff --git a/start.sh b/start.sh
index 25b805fc6..3cb1416eb 100755
--- a/start.sh
+++ b/start.sh
@@ -1 +1,5 @@
-./aria.sh; python3 -m bot
\ No newline at end of file
+pip3 -qq install --upgrade yt-dlp
+tracker_list=`curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt | awk '$1' | tr '\n' ',' | cat`
+echo -e "\nmax-concurrent-downloads=10\nbt-tracker=$tracker_list" >> /app/aria.conf
+aria2c --conf-path=/app/aria.conf
+python3 -m bot
\ No newline at end of file
From d6b213dfce8e7871e7464f2418e0dff39a31216f Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 22 Apr 2021 15:44:21 +0530
Subject: [PATCH 160/190] Credits Update
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index e296c1149..89e28fd58 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,4 @@ For The Most Recent Changes, Please Check The Changelog.👇
4. [Magneto](https://github.com/magneto261290) - Added Alot Of Customization, Support For Custom File Names, Support For Password Protected Archives, Quality Selection Option In YTDL And Much More.
5. [KenHV](https://github.com/KenHV) - Many Fixes And Imporovements.
6. [Anos](https://github.com/destiny6520) - Modification/Customization Guide.
+7. [Viswanath](https://github.com/nenokkadine) - Fixes & Improvements, Dockerfile Clean Up, DHT Support In Aria.
From e476b68c9b20ba65ff2d273671135ebd211f8e0f Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 22 Apr 2021 15:59:06 +0530
Subject: [PATCH 161/190] Fixing Typossssss
---
aria.conf | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/aria.conf b/aria.conf
index 8c560ace0..7d678bb62 100644
--- a/aria.conf
+++ b/aria.conf
@@ -6,8 +6,7 @@ rpc-listen-port=6800
rpc-max-request-size=1024M
# Connection
-split=32
-max-connection-per-server=16
+max-connection-per-server=10
check-certificate=false
min-split-size=4M
piece-length=1M
@@ -25,7 +24,7 @@ auto-save-interval=1
#BT
listen-port=51413
-bt-max-peers=40
+bt-max-peers=0
bt-request-peer-speed-limit=10M
max-overall-upload-limit=20M
max-upload-limit=0
From 6444e770464aedf5bf1cb7896eba041319269dfc Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 22 Apr 2021 16:17:11 +0530
Subject: [PATCH 162/190] Limiting Current Downloads
---
start.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/start.sh b/start.sh
index 3cb1416eb..4f733ca36 100755
--- a/start.sh
+++ b/start.sh
@@ -1,5 +1,5 @@
pip3 -qq install --upgrade yt-dlp
tracker_list=`curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt | awk '$1' | tr '\n' ',' | cat`
-echo -e "\nmax-concurrent-downloads=10\nbt-tracker=$tracker_list" >> /app/aria.conf
+echo -e "\nmax-concurrent-downloads=4\nbt-tracker=$tracker_list" >> /app/aria.conf
aria2c --conf-path=/app/aria.conf
-python3 -m bot
\ No newline at end of file
+python3 -m bot
From d929e9b052360d6f21dbcae23f060f8cfcec4042 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 23 Apr 2021 00:05:33 +0530
Subject: [PATCH 163/190] Low speed issue in some torrent fixed
---
aria.conf | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/aria.conf b/aria.conf
index 7d678bb62..0b86e458d 100644
--- a/aria.conf
+++ b/aria.conf
@@ -1,33 +1,27 @@
# RPC
enable-rpc=true
-rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
rpc-max-request-size=1024M
# Connection
-max-connection-per-server=10
+max-connection-per-server=14
check-certificate=false
-min-split-size=4M
-piece-length=1M
-lowest-speed-limit=0
+min-split-size=10M
max-overall-download-limit=0
disable-ipv6=true
split=10
# Aria
daemon=true
-referer=*
allow-overwrite=true
file-allocation=prealloc
-auto-save-interval=1
#BT
listen-port=51413
bt-max-peers=0
-bt-request-peer-speed-limit=10M
-max-overall-upload-limit=20M
-max-upload-limit=0
+bt-request-peer-speed-limit=0
+max-overall-upload-limit=0
seed-time=0.01
bt-tracker-connect-timeout=600
follow-torrent=mem
@@ -45,3 +39,4 @@ dht-file-path=/app/dht.dat
dht-file-path6=/app/dht6.dat
dht-entry-point=dht.transmissionbt.com:6881
dht-entry-point6=dht.transmissionbt.com:6881
+
From 615ed9edb494596530bb48aa92cb55d19de613b3 Mon Sep 17 00:00:00 2001
From: xd003
Date: Tue, 27 Apr 2021 09:00:03 +0530
Subject: [PATCH 164/190] Delete old TrackList before appending them at every
restart (#19)
* Delete old TrackList before appending them at every restart
* Clean aria.conf through string matching instead of line Number
---
start.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/start.sh b/start.sh
index 4f733ca36..fea7cb3a1 100755
--- a/start.sh
+++ b/start.sh
@@ -1,4 +1,5 @@
pip3 -qq install --upgrade yt-dlp
+sed -n -i '/max-concurrent-downloads/q;p' /app/aria.conf
tracker_list=`curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt | awk '$1' | tr '\n' ',' | cat`
echo -e "\nmax-concurrent-downloads=4\nbt-tracker=$tracker_list" >> /app/aria.conf
aria2c --conf-path=/app/aria.conf
From 018ec2d0b5fef15788b8a4c8168f3cde088e7bed Mon Sep 17 00:00:00 2001
From: Viswanath <65813999+nenokkadine@users.noreply.github.com>
Date: Mon, 17 May 2021 01:04:13 +0530
Subject: [PATCH 165/190] Optimise Docker image (#20)
* Optimize Docker Image Size~650MB
* Upgrade Mega SDK On Every Container Restart
* FFMPEG Static Build
---
Dockerfile | 42 +++++++++++++++++++++++++-----------------
requirements.txt | 2 +-
start.sh | 11 +++++++++++
3 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 45e756094..59e962ed9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,21 +1,30 @@
-FROM iamliquidx/megasdk:latest
+# Use Official Python Image
+FROM python:slim
-WORKDIR /app/
+WORKDIR /
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
+ENV LD_LIBRARY_PATH /usr/local/lib
-RUN apt-get -qq update && \
- apt-get install -y software-properties-common && \
- rm -rf /var/lib/apt/lists/* && \
- apt-add-repository non-free && \
+# Deps
+RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
apt-get -qq update && \
- apt-get -qq install -y p7zip-full p7zip-rar aria2 curl wget pv jq ffmpeg locales python3-lxml && \
- apt-get purge -y software-properties-common && \
- locale-gen en_US.UTF-8 && \
- chmod 777 /app/
+ apt-get -qq install -y \
+ libcurl4-openssl-dev \
+ libcrypto++-dev libsqlite3-dev libc-ares-dev \
+ libfreeimage-dev \
+ libsodium-dev \
+ libssl-dev \
+ libmagic-dev && \
+ apt-get install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils && \
+ apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
+ wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && \
+ tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
+ mv ff*/ff* /usr/local/bin/ && rm -rf ff*
+
+# Home Dir
+WORKDIR /app/
+# Mirror Bot files and requirements
COPY . .
RUN mv extract /usr/local/bin && \
mv pextract /usr/local/bin && \
@@ -25,8 +34,7 @@ RUN mv extract /usr/local/bin && \
wget -q https://github.com/P3TERX/aria2.conf/raw/master/dht6.dat -O /app/dht6.dat && \
mkdir -p /root/ && \
mv netrc /root/.netrc && \
- pip3 install --no-cache-dir -r requirements.txt
-
-CMD ["bash","start.sh"]
-
+ pip3 -q install --no-cache-dir -r requirements.txt
+# Script Which Starts the Bot
+CMD ["bash", "start.sh"]
diff --git a/requirements.txt b/requirements.txt
index 8bc466d1c..2c11ab759 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,7 +15,7 @@ beautifulsoup4
Pyrogram
TgCrypto
psycopg2-binary
-git+https://github.com/yt-dlp/yt-dlp
+yt-dlp
lxml
telegraph
speedtest-cli
diff --git a/start.sh b/start.sh
index fea7cb3a1..2e02ebcf0 100755
--- a/start.sh
+++ b/start.sh
@@ -1,3 +1,14 @@
+MEGA_VERSION=$(curl -s "https://api.github.com/repos/yzop/MegaSDK/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")' | sed -e 's/^v//')
+pip3 -q install https://github.com/yzop/MegaSDK/releases/download/v$MEGA_VERSION/megasdk-$MEGA_VERSION-py2.py3-none-any.whl
+LIB_VERSION="${MEGA_VERSION//./0}"
+if [[ -f "/usr/local/lib/python3.9/site-packages/mega/libmega.so" ]]; then
+ ln -s /usr/local/lib/python3.9/site-packages/mega/libmega.so /usr/local/lib/libmega.so.$LIB_VERSION
+elif [[ -f "/app/.local/lib/python3.9/site-packages/mega/libmega.so" ]]; then
+ ln -s /app/.local/lib/python3.9/site-packages/mega/libmega.so /usr/local/lib/libmega.so.$LIB_VERSION
+else
+ echo "Mega Shared Object not found Exiting"
+ exit 1
+fi
pip3 -qq install --upgrade yt-dlp
sed -n -i '/max-concurrent-downloads/q;p' /app/aria.conf
tracker_list=`curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt | awk '$1' | tr '\n' ',' | cat`
From 8c816cd1874ba17963f53cf4ec3ec7f3729586ad Mon Sep 17 00:00:00 2001
From: Viswanath <65813999+nenokkadine@users.noreply.github.com>
Date: Mon, 17 May 2021 10:32:02 +0530
Subject: [PATCH 166/190] Workflow for base image build (#21)
* Use base image to reduce build time
* Update Dockerfile
---
.github/workflows/base.yml | 23 +++++++++++++++++++++++
Dockerfile | 24 ++----------------------
Dockerfile.base | 21 +++++++++++++++++++++
3 files changed, 46 insertions(+), 22 deletions(-)
create mode 100644 .github/workflows/base.yml
create mode 100644 Dockerfile.base
diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml
new file mode 100644
index 000000000..6f7617ac8
--- /dev/null
+++ b/.github/workflows/base.yml
@@ -0,0 +1,23 @@
+name: MirrorX Base image
+
+on: workflow_dispatch
+
+env:
+ IMAGE: ghcr.io/iamliquidx/mirrorx
+
+jobs:
+ push:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Login to ghcr.io Registry
+ run: docker login https://ghcr.io -u token -p ${{ secrets.GH_TOKEN }}
+
+ - name: Build and Push Docker image
+ run: |
+ echo "Building"
+ docker build . -f Dockerfile.base -t ${{ env.IMAGE }}:latest
+ echo "Pushing"
+ docker push ${{ env.IMAGE }}:latest
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 59e962ed9..43b769772 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,25 +1,5 @@
-# Use Official Python Image
-FROM python:slim
-
-WORKDIR /
-
-ENV LD_LIBRARY_PATH /usr/local/lib
-
-# Deps
-RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
- apt-get -qq update && \
- apt-get -qq install -y \
- libcurl4-openssl-dev \
- libcrypto++-dev libsqlite3-dev libc-ares-dev \
- libfreeimage-dev \
- libsodium-dev \
- libssl-dev \
- libmagic-dev && \
- apt-get install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils && \
- apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
- wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && \
- tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
- mv ff*/ff* /usr/local/bin/ && rm -rf ff*
+# Base Image
+FROM ghcr.io/iamliquidx/mirrorx
# Home Dir
WORKDIR /app/
diff --git a/Dockerfile.base b/Dockerfile.base
new file mode 100644
index 000000000..7e4f6fb51
--- /dev/null
+++ b/Dockerfile.base
@@ -0,0 +1,21 @@
+FROM python:slim
+
+WORKDIR /
+
+ENV LD_LIBRARY_PATH /usr/local/lib
+
+# Deps
+RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
+ apt-get -qq update && \
+ apt-get -qq install -y \
+ libcurl4-openssl-dev \
+ libcrypto++-dev libsqlite3-dev libc-ares-dev \
+ libfreeimage-dev \
+ libsodium-dev \
+ libssl-dev \
+ libmagic-dev && \
+ apt-get install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils && \
+ apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
+ wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && \
+ tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
+ mv ff*/ff* /usr/local/bin/ && rm -rf ff*
From 1dfa5649aa51b42732bd04fac42bcf34cd81a8cf Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 18 May 2021 20:18:06 +0530
Subject: [PATCH 167/190] mirror: Fix for uploading telegram file_name of None
type
sometimes pyrogram send media.file_name as None. Bot gives Error:
`[Errno 2] No such file or directory:
'/home/username/mirror-bot/downloads/567/None'`
---
bot/modules/mirror.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 4a2837025..74219b201 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -60,7 +60,9 @@ def onDownloadComplete(self):
download = download_dict[self.uid]
name = download.name()
size = download.size_raw()
- m_path = f'{DOWNLOAD_DIR}{self.uid}/{download.name()}'
+ if name is None: # when pyrogram's media.file_name is of NoneType
+ name = os.listdir(f'{DOWNLOAD_DIR}{self.uid}')[0]
+ m_path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
if self.isTar:
download.is_archiving = True
try:
From f7167fb2e925dfeb55c8664e0c5838ea5f41da34 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 18 May 2021 20:19:51 +0530
Subject: [PATCH 168/190] Fix /watch download msg progress
Fixed download progress not getting update.
---
.../mirror_utils/download_utils/youtube_dl_download_helper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
index e7b9d9315..1bf3bb747 100644
--- a/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
+++ b/bot/helper/mirror_utils/download_utils/youtube_dl_download_helper.py
@@ -36,7 +36,7 @@ def error(msg):
class YoutubeDLHelper(DownloadHelper):
def __init__(self, listener):
super().__init__()
- self.__name = ""
+ self.name = ""
self.__start_time = time.time()
self.__listener = listener
self.__gid = ""
From 8ce247b1b193a00de6c489b197bbe07159891b01 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Tue, 8 Jun 2021 14:58:12 +0530
Subject: [PATCH 169/190] Changing client mask to qBit
---
aria.conf | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/aria.conf b/aria.conf
index 0b86e458d..7b7326fca 100644
--- a/aria.conf
+++ b/aria.conf
@@ -27,9 +27,9 @@ bt-tracker-connect-timeout=600
follow-torrent=mem
bt-force-encryption=true
bt-stop-timeout=600
-user-agent=Transmission 2.94
-peer-agent=Transmission 2.94
-peer-id-prefix=-TR2940-
+user-agent=qBittorrent/4.3.5
+peer-agent=qBittorrent/4.3.5
+peer-id-prefix=-qB4350-
#DHT
dht-listen-port=51513
From 93b4cd5a9cac06e1ac8695accd4caf081d839151 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 19 Jun 2021 18:39:50 +0530
Subject: [PATCH 170/190] added count
added the count option to help get the file size and file number of a gdrive link.
user /count
---
bot/__main__.py | 4 +-
.../mirror_utils/upload_utils/gdriveTools.py | 71 ++++++++++++++++++-
bot/helper/telegram_helper/bot_commands.py | 1 +
bot/modules/count.py | 23 ++++++
4 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 bot/modules/count.py
diff --git a/bot/__main__.py b/bot/__main__.py
index e8399de49..cf7aa5972 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -12,7 +12,7 @@
from bot.helper.telegram_helper.message_utils import *
from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time
from .helper.telegram_helper.filters import CustomFilters
-from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest
+from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, delete, speedtest, count
from pyrogram import idle
from bot import app
@@ -78,6 +78,8 @@ def bot_help(update, context):
/{BotCommands.UnzipMirrorCommand} [download_url][magnet_link] : starts mirroring and if downloaded file is any archive , extracts it to google drive
+/{BotCommands.CountCommand}: Count files/folders of G-Drive Links
+
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: start mirroring and upload the archived (.tar) version of the download
/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help.
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 32b72ed9c..d924ec475 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -308,6 +308,8 @@ def getFilesByFolderId(self,folder_id):
def clone(self, link):
self.transferred_size = 0
+ self.total_files = 0
+ self.total_folders = 0
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
@@ -578,4 +580,71 @@ def drive_list(self, fileName):
return msg, InlineKeyboardMarkup(buttons.build_menu(1))
else :
- return '', ''
\ No newline at end of file
+ return '', ''
+
+
+
+ def count(self, link):
+ self.total_bytes = 0
+ self.total_files = 0
+ self.total_folders = 0
+ try:
+ file_id = self.getIdFromUrl(link)
+ except (KeyError,IndexError):
+ msg = "Google drive ID could not be found in the provided link"
+ return msg
+ msg = ""
+ LOGGER.info(f"File ID: {file_id}")
+ try:
+ drive_file = self.__service.files().get(fileId=file_id, fields="id, name, mimeType, size",
+ supportsTeamDrives=True).execute()
+ name = drive_file['name']
+ LOGGER.info(f"Counting: {name}")
+ if drive_file['mimeType'] == self.__G_DRIVE_DIR_MIME_TYPE:
+ self.gDrive_directory(**drive_file)
+ msg += f'Name : {name}'
+ msg += f'\nSize : {get_readable_file_size(self.total_bytes)}'
+ msg += f"\nType : Folder"
+ msg += f"\nSubFolders : {self.total_folders}"
+ msg += f"\nFiles : {self.total_files}"
+ else:
+ msg += f'Filename : {name}'
+ try:
+ typee = drive_file['mimeType']
+ except:
+ typee = 'File'
+ try:
+ self.total_files += 1
+ self.gDrive_file(**drive_file)
+ msg += f'\nSize : {get_readable_file_size(self.total_bytes)}'
+ msg += f"\nType : {typee}"
+ msg += f"\nFiles : {self.total_files}"
+ except TypeError:
+ pass
+ except Exception as err:
+ if isinstance(err, RetryError):
+ LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
+ err = err.last_attempt.exception()
+ err = str(err).replace('>', '').replace('<', '')
+ LOGGER.error(err)
+ return err
+ return msg
+
+ def gDrive_file(self, **kwargs):
+ try:
+ size = int(kwargs['size'])
+ except:
+ size = 0
+ self.total_bytes += size
+
+ def gDrive_directory(self, **kwargs) -> None:
+ files = self.getFilesByFolderId(kwargs['id'])
+ if len(files) == 0:
+ return
+ for file_ in files:
+ if file_['mimeType'] == self.__G_DRIVE_DIR_MIME_TYPE:
+ self.total_folders += 1
+ self.gDrive_directory(**file_)
+ else:
+ self.total_files += 1
+ self.gDrive_file(**file_)
\ No newline at end of file
diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py
index 2eff85ce0..046bad1e1 100644
--- a/bot/helper/telegram_helper/bot_commands.py
+++ b/bot/helper/telegram_helper/bot_commands.py
@@ -8,6 +8,7 @@ def __init__(self):
self.CancelAllCommand = 'cancelall'
self.ListCommand = 'list'
self.SpeedCommand = 'speedtest'
+ self.CountCommand = 'count'
self.StatusCommand = 'status'
self.AuthorizeCommand = 'authorize'
self.UnAuthorizeCommand = 'unauthorize'
diff --git a/bot/modules/count.py b/bot/modules/count.py
new file mode 100644
index 000000000..8d01c0e24
--- /dev/null
+++ b/bot/modules/count.py
@@ -0,0 +1,23 @@
+import bot
+
+from telegram.ext import CommandHandler
+from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
+from bot.helper.telegram_helper.message_utils import deleteMessage, sendMessage
+from bot.helper.telegram_helper.filters import CustomFilters
+from bot.helper.telegram_helper.bot_commands import BotCommands
+from bot import dispatcher, AUTHORIZED_CHATS
+
+def countNode(update,context):
+ args = update.message.text.split(" ",maxsplit=1)
+ if len(args) > 1:
+ link = args[1]
+ msg = sendMessage(f"Counting: {link}",context.bot,update)
+ gd = GoogleDriveHelper()
+ result = gd.count(link)
+ deleteMessage(context.bot,msg)
+ sendMessage(result,context.bot,update)
+ else:
+ sendMessage("Provide G-Drive Shareable Link to Count.",context.bot,update)
+
+count_handler = CommandHandler(BotCommands.CountCommand,countNode,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
+dispatcher.add_handler(count_handler)
\ No newline at end of file
From aa4d0079005cf478c48a59d8c1441362182e0bc1 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sat, 19 Jun 2021 19:01:59 +0530
Subject: [PATCH 171/190] clone & count tags user
clone and count now tags the user after process gets completed.
---
bot/modules/clone.py | 8 +++++++-
bot/modules/count.py | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/bot/modules/clone.py b/bot/modules/clone.py
index 9facc0b7d..1ecd8c1f9 100644
--- a/bot/modules/clone.py
+++ b/bot/modules/clone.py
@@ -18,7 +18,13 @@ def cloneNode(update,context):
if button == "":
sendMessage(result,context.bot,update)
else:
- sendMarkup(result,context.bot,update,button)
+ if update.message.from_user.username:
+ uname = f'@{update.message.from_user.username}'
+ else:
+ uname = f'{update.message.from_user.first_name}'
+ if uname is not None:
+ cc = f'\n\nReq. By: {uname}'
+ sendMarkup(result + cc, context.bot, update, button)
else:
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
diff --git a/bot/modules/count.py b/bot/modules/count.py
index 8d01c0e24..fe64e3535 100644
--- a/bot/modules/count.py
+++ b/bot/modules/count.py
@@ -15,7 +15,13 @@ def countNode(update,context):
gd = GoogleDriveHelper()
result = gd.count(link)
deleteMessage(context.bot,msg)
- sendMessage(result,context.bot,update)
+ if update.message.from_user.username:
+ uname = f'@{update.message.from_user.username}'
+ else:
+ uname = f'{update.message.from_user.first_name}'
+ if uname is not None:
+ cc = f'\n\nReq. By: {uname}'
+ sendMessage(result + cc, context.bot, update)
else:
sendMessage("Provide G-Drive Shareable Link to Count.",context.bot,update)
From 339fae170a33e79563f40c26dd44158cd6ea0449 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 20 Jun 2021 10:16:15 +0530
Subject: [PATCH 172/190] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 89e28fd58..5b6f26a19 100644
--- a/README.md
+++ b/README.md
@@ -35,3 +35,4 @@ For The Most Recent Changes, Please Check The Changelog.👇
5. [KenHV](https://github.com/KenHV) - Many Fixes And Imporovements.
6. [Anos](https://github.com/destiny6520) - Modification/Customization Guide.
7. [Viswanath](https://github.com/nenokkadine) - Fixes & Improvements, Dockerfile Clean Up, DHT Support In Aria.
+8. [breakdowns](https://github.com/breakdowns) - Source code for count.
From b20683e4c6225c935c8a9c7415eca64a8ef5b610 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 20 Jun 2021 10:57:31 +0530
Subject: [PATCH 173/190] zip/unzip gdrive folder/files,fembed support
Added the ability to zip and unzip folder/files/archives directly from gdrive links.
Added direct link gen for fembed.
Added credits.
---
bot/helper/ext_utils/bot_utils.py | 2 +
.../download_utils/direct_link_generator.py | 22 +++
.../status_utils/gdownload_status.py | 63 +++++++
.../mirror_utils/upload_utils/gdriveTools.py | 170 +++++++++++++++++-
bot/modules/mirror.py | 24 ++-
requirements.txt | 2 +
6 files changed, 273 insertions(+), 10 deletions(-)
create mode 100644 bot/helper/mirror_utils/status_utils/gdownload_status.py
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index cf49ef827..9a48b15cf 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -146,6 +146,8 @@ def is_magnet(url: str):
return True
return False
+def is_gdrive_link(url: str):
+ return "drive.google.com" in url
def is_mega_link(url: str):
return "mega.nz" in url
diff --git a/bot/helper/mirror_utils/download_utils/direct_link_generator.py b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
index 5054056ed..b00728517 100644
--- a/bot/helper/mirror_utils/download_utils/direct_link_generator.py
+++ b/bot/helper/mirror_utils/download_utils/direct_link_generator.py
@@ -10,14 +10,19 @@
import json
import re
+import math
import urllib.parse
from os import popen
from random import choice
+from urllib.parse import urlparse
+import lk21
import requests
import logging
from bot import UPTOBOX_TOKEN
from bs4 import BeautifulSoup
+from lk21.extractors.bypasser import Bypass
+from base64 import standard_b64encode
from js2py import EvalJs
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
@@ -41,6 +46,12 @@ def direct_link_generator(link: str):
return osdn(link)
elif 'github.com' in link:
return github(link)
+ elif 'fembed.com' in link:
+ return fembed(link)
+ elif 'femax20.com' in link:
+ return fembed(link)
+ elif 'feurl.com' in link:
+ return fembed(link)
else:
raise DirectDownloadLinkException(f'No Direct link function found for {link}')
@@ -199,3 +210,14 @@ def useragent():
'lxml').findAll('td', {'class': 'useragent'})
user_agent = choice(useragents)
return user_agent.text
+
+def fembed(link: str) -> str:
+ """ Fembed direct link generator
+ Based on https://github.com/breakdowns/slam-mirrorbot """
+ bypasser = lk21.Bypass()
+ dl_url=bypasser.bypass_fembed(link)
+ lst_link = []
+ count = len(dl_url)
+ for i in dl_url:
+ lst_link.append(dl_url[i])
+ return lst_link[count-1]
diff --git a/bot/helper/mirror_utils/status_utils/gdownload_status.py b/bot/helper/mirror_utils/status_utils/gdownload_status.py
new file mode 100644
index 000000000..5793ce289
--- /dev/null
+++ b/bot/helper/mirror_utils/status_utils/gdownload_status.py
@@ -0,0 +1,63 @@
+import bot
+
+from .status import Status
+from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time
+from bot import DOWNLOAD_DIR
+
+
+class DownloadStatus(Status):
+ def __init__(self, obj, size, listener, gid):
+ self.dobj = obj
+ self.__dsize = size
+ self.uid = listener.uid
+ self.message = listener.message
+ self.__dgid = gid
+
+ def path(self):
+ return f"{DOWNLOAD_DIR}{self.uid}"
+
+ def processed_bytes(self):
+ return self.dobj.downloaded_bytes
+
+ def size_raw(self):
+ return self.__dsize
+
+ def size(self):
+ return get_readable_file_size(self.__dsize)
+
+ def status(self):
+ return MirrorStatus.STATUS_DOWNLOADING
+
+ def name(self):
+ return self.dobj.name
+
+ def gid(self) -> str:
+ return self.__dgid
+
+ def progress_raw(self):
+ try:
+ return self.dobj.downloaded_bytes / self.__dsize * 100
+ except ZeroDivisionError:
+ return 0
+
+ def progress(self):
+ return f'{round(self.progress_raw(), 2)}%'
+
+ def speed_raw(self):
+ """
+ :return: Download speed in Bytes/Seconds
+ """
+ return self.dobj.dspeed()
+
+ def speed(self):
+ return f'{get_readable_file_size(self.speed_raw())}/s'
+
+ def eta(self):
+ try:
+ seconds = (self.__dsize - self.dobj.downloaded_bytes) / self.speed_raw()
+ return f'{get_readable_time(seconds)}'
+ except ZeroDivisionError:
+ return '-'
+
+ def download(self):
+ return self.dobj
\ No newline at end of file
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index d924ec475..9959e6d5e 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -1,4 +1,4 @@
-import os
+import io
import pickle
import urllib.parse as urlparse
from urllib.parse import parse_qs
@@ -13,7 +13,7 @@
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
-from googleapiclient.http import MediaFileUpload
+from googleapiclient.http import MediaFileUpload, MediaIoBaseDownload
from tenacity import *
from telegram import InlineKeyboardMarkup
@@ -45,19 +45,26 @@ def __init__(self, name=None, listener=None):
self.__service = self.authorize()
self.__listener = listener
self._file_uploaded_bytes = 0
+ self._file_downloaded_bytes = 0
self.uploaded_bytes = 0
+ self.downloaded_bytes = 0
self.UPDATE_INTERVAL = 5
self.start_time = 0
self.total_time = 0
+ self.dtotal_time = 0
self._should_update = True
self.is_uploading = True
self.is_cancelled = False
self.status = None
+ self.dstatus = None
self.updater = None
self.name = name
self.update_interval = 3
self.telegraph_content = []
self.path = []
+ self.total_bytes = 0
+ self.total_files = 0
+ self.total_folders = 0
def cancel(self):
self.is_cancelled = True
@@ -72,6 +79,13 @@ def speed(self):
return self.uploaded_bytes / self.total_time
except ZeroDivisionError:
return 0
+
+ def dspeed(self):
+ try:
+ return self.downloaded_bytes / self.dtotal_time
+ except ZeroDivisionError:
+ return 0
+
@staticmethod
def getIdFromUrl(link: str):
@@ -486,9 +500,9 @@ def edit_telegraph(self):
content += f' | Next'
nxt_page += 1
Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page],
- title = 'Mirror Bot Search',
- author_name='Mirror Bot',
- author_url='https://github.com/magneto261290/magneto-python-aria',
+ title = 'MirrorX Search',
+ author_name='MirrorX',
+ author_url='https://github.com/iamLiquidX',
html_content=content)
return
@@ -563,9 +577,9 @@ def drive_list(self, fileName):
for content in self.telegraph_content :
self.path.append(Telegraph(access_token=telegraph_token).create_page(
- title = 'Mirror Bot Search',
- author_name='Mirror Bot',
- author_url='https://github.com/magneto261290/magneto-python-aria',
+ title = 'MirrorX Search',
+ author_name='MirrorX',
+ author_url='https://github.com/iamLiquidX',
html_content=content
)['path'])
@@ -647,4 +661,142 @@ def gDrive_directory(self, **kwargs) -> None:
self.gDrive_directory(**file_)
else:
self.total_files += 1
- self.gDrive_file(**file_)
\ No newline at end of file
+ self.gDrive_file(**file_)
+
+ def clonehelper(self, link):
+ try:
+ file_id = self.getIdFromUrl(link)
+ except (KeyError,IndexError):
+ msg = "Google drive ID could not be found in the provided link"
+ return msg, "", ""
+ LOGGER.info(f"File ID: {file_id}")
+ try:
+ drive_file = self.__service.files().get(fileId=file_id, fields="id, name, mimeType, size",
+ supportsTeamDrives=True).execute()
+ name = drive_file['name']
+ LOGGER.info(f"Checking: {name}")
+ if drive_file['mimeType'] == self.__G_DRIVE_DIR_MIME_TYPE:
+ self.gDrive_directory(**drive_file)
+ else:
+ try:
+ self.total_files += 1
+ self.gDrive_file(**drive_file)
+ except TypeError:
+ pass
+ clonesize = self.total_bytes
+ except Exception as err:
+ if isinstance(err, RetryError):
+ LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
+ err = err.last_attempt.exception()
+ err = str(err).replace('>', '').replace('<', '')
+ LOGGER.error(err)
+ if "File not found" in str(err):
+ msg = "File not found."
+ else:
+ msg = f"Error.\n{err}"
+ return msg, "", ""
+ return "", clonesize, name
+
+ def download(self, link):
+ self.is_downloading = True
+ file_id = self.getIdFromUrl(link)
+ if USE_SERVICE_ACCOUNTS:
+ self.service_account_count = len(os.listdir("accounts"))
+ self.start_time = time.time()
+ self.updater = setInterval(self.update_interval, self._on_download_progress)
+ try:
+ meta = self.getFileMetadata(file_id)
+ path = f"{DOWNLOAD_DIR}{self.__listener.uid}/"
+ if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
+ self.download_folder(file_id, path, meta.get('name'))
+ else:
+ os.makedirs(path)
+ self.download_file(file_id, path, meta.get('name'), meta.get('mimeType'))
+ except Exception as err:
+ if isinstance(err, RetryError):
+ LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
+ err = err.last_attempt.exception()
+ err = str(err).replace('>', '').replace('<', '')
+ LOGGER.error(err)
+ self.is_cancelled = True
+ self.__listener.onDownloadError(err)
+ return
+ finally:
+ self.updater.cancel()
+ if self.is_cancelled:
+ return
+ self.__listener.onDownloadComplete()
+
+ def download_folder(self, folder_id, path, folder_name):
+ if not os.path.exists(path + folder_name):
+ os.makedirs(path + folder_name)
+ path += folder_name + '/'
+ result = []
+ page_token = None
+ while True:
+ files = self.__service.files().list(
+ supportsTeamDrives=True,
+ includeTeamDriveItems=True,
+ q=f"'{folder_id}' in parents",
+ fields='nextPageToken, files(id, name, mimeType, size, shortcutDetails)',
+ pageToken=page_token,
+ pageSize=1000).execute()
+ result.extend(files['files'])
+ page_token = files.get("nextPageToken")
+ if not page_token:
+ break
+
+ result = sorted(result, key=lambda k: k['name'])
+ for item in result:
+ file_id = item['id']
+ filename = item['name']
+ mime_type = item['mimeType']
+ shortcut_details = item.get('shortcutDetails', None)
+ if shortcut_details != None:
+ file_id = shortcut_details['targetId']
+ mime_type = shortcut_details['targetMimeType']
+ if mime_type == 'application/vnd.google-apps.folder':
+ self.download_folder(file_id, path, filename)
+ elif not os.path.isfile(path + filename):
+ self.download_file(file_id, path, filename, mime_type)
+ if self.is_cancelled:
+ break
+ return
+
+ def download_file(self, file_id, path, filename, mime_type):
+ request = self.__service.files().get_media(fileId=file_id)
+ fh = io.FileIO('{}{}'.format(path, filename), 'wb')
+ downloader = MediaIoBaseDownload(fh, request, chunksize = 50 * 1024 * 1024)
+ done = False
+ while done is False:
+ if self.is_cancelled:
+ fh.close()
+ break
+ return
+ try:
+ self.dstatus, done = downloader.next_chunk()
+ except HttpError as err:
+ if err.resp.get('content-type', '').startswith('application/json'):
+ reason = json.loads(err.content).get('error').get('errors')[0].get('reason')
+ if reason == 'userRateLimitExceeded' or reason == 'dailyLimitExceeded':
+ if USE_SERVICE_ACCOUNTS:
+ if not self.switchServiceAccount():
+ raise err
+ LOGGER.info(f"Got: {reason}, Trying Again...")
+ return self.download_file(file_id, path, filename, mime_type)
+ else:
+ raise err
+ else:
+ raise err
+ self._file_downloaded_bytes = 0
+
+ def _on_download_progress(self):
+ if self.dstatus is not None:
+ chunk_size = self.dstatus.total_size * self.dstatus.progress() - self._file_downloaded_bytes
+ self._file_downloaded_bytes = self.dstatus.total_size * self.dstatus.progress()
+ self.downloaded_bytes += chunk_size
+ self.dtotal_time += self.update_interval
+
+ def cancel_download(self):
+ self.is_cancelled = True
+ self.__listener.onDownloadError('Download stopped by user!')
\ No newline at end of file
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 74219b201..606aeb2e3 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -15,6 +15,7 @@
from bot.helper.mirror_utils.status_utils.extract_status import ExtractStatus
from bot.helper.mirror_utils.status_utils.tar_status import TarStatus
from bot.helper.mirror_utils.status_utils.upload_status import UploadStatus
+from bot.helper.mirror_utils.status_utils.gdownload_status import DownloadStatus
from bot.helper.mirror_utils.upload_utils import gdriveTools
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.filters import CustomFilters
@@ -26,6 +27,8 @@
import subprocess
import threading
import re
+import random
+import string
ariaDlManager = AriaDownloadHelper()
ariaDlManager.start_listener()
@@ -273,7 +276,26 @@ def _mirror(bot, update, isTar=False, extract=False):
except DirectDownloadLinkException as e:
LOGGER.info(f'{link}: {e}')
listener = MirrorListener(bot, update, pswd, isTar, tag, extract)
- if bot_utils.is_mega_link(link):
+ if bot_utils.is_gdrive_link(link):
+ if not isTar and not extract:
+ sendMessage(f"Use /{BotCommands.CloneCommand} To Copy File/Folder", bot, update)
+ return
+ res, size, name = gdriveTools.GoogleDriveHelper().clonehelper(link)
+ if res != "":
+ sendMessage(res, bot, update)
+ return
+ LOGGER.info(f"Download Name : {name}")
+ drive = gdriveTools.GoogleDriveHelper(name, listener)
+ gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=12))
+ download_status = DownloadStatus(drive, size, listener, gid)
+ with download_dict_lock:
+ download_dict[listener.uid] = download_status
+ if len(Interval) == 0:
+ Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
+ sendStatusMessage(update, bot)
+ drive.download(link)
+
+ elif bot_utils.is_mega_link(link):
if BLOCK_MEGA_LINKS:
sendMessage("Mega Links Are Blocked ✋", bot, update)
else:
diff --git a/requirements.txt b/requirements.txt
index 2c11ab759..14c162be3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -20,3 +20,5 @@ lxml
telegraph
speedtest-cli
messages
+pybase64
+lk21
\ No newline at end of file
From 7180660f3a34d23ba26eb6ceba403ed27b1cedba Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 20 Jun 2021 11:00:40 +0530
Subject: [PATCH 174/190] Added Creds.
Let's not forget the hard workers.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5b6f26a19..7d7bc2555 100644
--- a/README.md
+++ b/README.md
@@ -35,4 +35,4 @@ For The Most Recent Changes, Please Check The Changelog.👇
5. [KenHV](https://github.com/KenHV) - Many Fixes And Imporovements.
6. [Anos](https://github.com/destiny6520) - Modification/Customization Guide.
7. [Viswanath](https://github.com/nenokkadine) - Fixes & Improvements, Dockerfile Clean Up, DHT Support In Aria.
-8. [breakdowns](https://github.com/breakdowns) - Source code for count.
+8. [breakdowns](https://github.com/breakdowns) - Source Code For Count,Zip/Unzip GDrive Links & Fembed.
From 4d504310e4aec7f6274c0d7a5619d74953710024 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 20 Jun 2021 11:20:46 +0530
Subject: [PATCH 175/190] Typo
i am blind.
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 9959e6d5e..ca21130d9 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -1,3 +1,4 @@
+import os
import io
import pickle
import urllib.parse as urlparse
@@ -799,4 +800,4 @@ def _on_download_progress(self):
def cancel_download(self):
self.is_cancelled = True
- self.__listener.onDownloadError('Download stopped by user!')
\ No newline at end of file
+ self.__listener.onDownloadError('Download stopped by user!')
From 9064440bb8cf124b17caccb4910253b15ee0fe4f Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Sun, 27 Jun 2021 10:46:42 +0530
Subject: [PATCH 176/190] Fix to zip/unzip getting over 100%
In some cases the zip/unzip from gdrive was going over 100%, fixed now.
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index ca21130d9..ad7044c22 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -767,7 +767,7 @@ def download_folder(self, folder_id, path, folder_name):
def download_file(self, file_id, path, filename, mime_type):
request = self.__service.files().get_media(fileId=file_id)
fh = io.FileIO('{}{}'.format(path, filename), 'wb')
- downloader = MediaIoBaseDownload(fh, request, chunksize = 50 * 1024 * 1024)
+ downloader = MediaIoBaseDownload(fh, request, chunksize = 100 * 1024 * 1024)
done = False
while done is False:
if self.is_cancelled:
@@ -789,7 +789,7 @@ def download_file(self, file_id, path, filename, mime_type):
raise err
else:
raise err
- self._file_downloaded_bytes = 0
+ self._file_downloaded_bytes = 0
def _on_download_progress(self):
if self.dstatus is not None:
From 6803dccd6a72e7403f1bde0a6358343c7aa32685 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Fri, 2 Jul 2021 22:07:19 +0530
Subject: [PATCH 177/190] Switching to MEGAREST (#27)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Use MegaREST Client
- thanks to @JaskaranSM
* Move Everything to Seperate Folders
* Fix up dockerfile
- initiate steps to make it a package
* Start Aria as a Child Process
- Config, DHT Files are imported from package everytime
* ✨
* Add Docker Compose
- Update release workflow
- Fix Error in List command which throws when someone edits the message
- Add Customizable Command
- Release Workflow will publish the Package to the Pypi
* Example's added how to mount folders to container
- v5.9.9
---
.github/workflows/base.yml | 23 ---
.github/workflows/release.yml | 68 +++++++
.gitignore | 12 +-
.gitmodules | 3 -
Dockerfile | 38 ++--
Dockerfile.base | 21 ---
extract => bin/extract | 0
pextract => bin/pextract | 0
bot/__init__.py | 86 +++++++--
aria.conf => bot/data/aria.conf | 7 +-
bot/data/dht.dat | Bin 0 -> 70616 bytes
bot/data/dht6.dat | Bin 0 -> 8960 bytes
bot/helper/ext_utils/bot_utils.py | 2 +-
bot/helper/ext_utils/fs_utils.py | 6 +-
.../download_utils/download_helper.py | 4 +-
.../download_utils/mega_download.py | 108 +++++++++++
.../download_utils/mega_downloader.py | 172 ------------------
...mega_download_status.py => mega_status.py} | 66 +++----
.../mirror_utils/upload_utils/gdriveTools.py | 2 +-
bot/helper/telegram_helper/bot_commands.py | 51 +++---
bot/helper/telegram_helper/message_utils.py | 1 -
bot/modules/list.py | 2 +
bot/modules/mirror.py | 12 +-
captain-definition | 4 -
config_sample.env | 34 +++-
docker-compose.yml | 21 +++
requirements.txt | 4 +-
setup.py | 67 +++++++
start.sh | 17 --
.../add_to_team_drive.py | 0
.../gen_sa_accounts.py | 0
.../generate_drive_token.py | 0
vendor/cmrudl.py | 1 -
33 files changed, 481 insertions(+), 351 deletions(-)
delete mode 100644 .github/workflows/base.yml
create mode 100644 .github/workflows/release.yml
delete mode 100644 .gitmodules
delete mode 100644 Dockerfile.base
rename extract => bin/extract (100%)
rename pextract => bin/pextract (100%)
rename aria.conf => bot/data/aria.conf (88%)
create mode 100644 bot/data/dht.dat
create mode 100644 bot/data/dht6.dat
create mode 100644 bot/helper/mirror_utils/download_utils/mega_download.py
delete mode 100644 bot/helper/mirror_utils/download_utils/mega_downloader.py
rename bot/helper/mirror_utils/status_utils/{mega_download_status.py => mega_status.py} (54%)
delete mode 100644 captain-definition
create mode 100644 docker-compose.yml
create mode 100644 setup.py
delete mode 100755 start.sh
rename add_to_team_drive.py => utils/add_to_team_drive.py (100%)
rename gen_sa_accounts.py => utils/gen_sa_accounts.py (100%)
rename generate_drive_token.py => utils/generate_drive_token.py (100%)
delete mode 160000 vendor/cmrudl.py
diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml
deleted file mode 100644
index 6f7617ac8..000000000
--- a/.github/workflows/base.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-name: MirrorX Base image
-
-on: workflow_dispatch
-
-env:
- IMAGE: ghcr.io/iamliquidx/mirrorx
-
-jobs:
- push:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Login to ghcr.io Registry
- run: docker login https://ghcr.io -u token -p ${{ secrets.GH_TOKEN }}
-
- - name: Build and Push Docker image
- run: |
- echo "Building"
- docker build . -f Dockerfile.base -t ${{ env.IMAGE }}:latest
- echo "Pushing"
- docker push ${{ env.IMAGE }}:latest
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..83d78f9ae
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,68 @@
+name: MirrorX Release
+
+on:
+ push:
+ tags:
+ - "v*.*.*"
+
+jobs:
+ BuildWheel:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup Python
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.9.6
+ - name: Get the version
+ id: get_version
+ run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
+ - name: Install deps fro Pypi Release
+ run: |
+ pip -q install setuptools wheel twine
+ pip -q install -r requirements.txt
+ - name: Publish to pypi
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+ run: |
+ python setup.py sdist bdist_wheel
+ twine upload dist/*
+ - name: Upload all the data files to github Release
+ uses: softprops/action-gh-release@v1
+ with:
+ name: MirrorX Release ${{ steps.get_version.outputs.VERSION }}
+ files: |
+ dist/*
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Sleep
+ run: sleep 60
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+ with:
+ platforms: arm64
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: token
+ password: ${{ secrets.GH_TOKEN }}
+ - name: Docker meta
+ id: metaraw
+ uses: docker/metadata-action@v3
+ with:
+ images: ghcr.io/iamliquidx/mirrorx
+ tags: |
+ type=semver,pattern={{version}}
+ - name: Build and push LTS RAW
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ file: ./Dockerfile
+ platforms: linux/amd64, linux/arm64/v8
+ push: true
+ tags: ${{ steps.metaraw.outputs.tags }}
+ labels: ${{ steps.metaraw.outputs.labels }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 86facd3c1..1fc1cd804 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,19 @@
config.env
*auth_token.txt
-*.pyc
downloads/*
download/*
-data*
.vscode
.idea
*.json
*.pickle
authorized_chats.txt
log.txt
-accounts/*
\ No newline at end of file
+accounts/*
+*.pyc
+dht6.dat
+aria.conf
+.gitignore
+dht.dat
+build
+dist
+*.spec
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index ea40a2d28..000000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "vendor/cmrudl.py"]
- path = vendor/cmrudl.py
- url = https://github.com/JrMasterModelBuilder/cmrudl.py.git
diff --git a/Dockerfile b/Dockerfile
index 43b769772..360999515 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,20 +1,24 @@
-# Base Image
-FROM ghcr.io/iamliquidx/mirrorx
+FROM python:slim
-# Home Dir
-WORKDIR /app/
+WORKDIR /
+# Deps
+RUN if [ "$(uname -m)" = "aarch64" ] ; then \
+ export HOST_CPU_ARCH=arm64; \
+ elif [ "$(uname -m)" = "x86_64" ]; then \
+ export HOST_CPU_ARCH=amd64; \
+ fi && \
+ sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
+ apt-get -qq update && \
+ apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev && \
+ apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
+ wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
+ tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
+ mv ff*/ff* /usr/local/bin/ && rm -rf ff* && \
+ wget -q https://github.com/viswanathbalusu/megasdkrest/releases/download/v0.1.0/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
+ chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/
-# Mirror Bot files and requirements
-COPY . .
-RUN mv extract /usr/local/bin && \
- mv pextract /usr/local/bin && \
- chmod +x /usr/local/bin/extract && \
- chmod +x /usr/local/bin/pextract && \
- wget -q https://github.com/P3TERX/aria2.conf/raw/master/dht.dat -O /app/dht.dat && \
- wget -q https://github.com/P3TERX/aria2.conf/raw/master/dht6.dat -O /app/dht6.dat && \
- mkdir -p /root/ && \
- mv netrc /root/.netrc && \
- pip3 -q install --no-cache-dir -r requirements.txt
+RUN pip3 install --no-cache-dir MirrorX
+WORKDIR /app
+
+CMD ["MirrorX"]
-# Script Which Starts the Bot
-CMD ["bash", "start.sh"]
diff --git a/Dockerfile.base b/Dockerfile.base
deleted file mode 100644
index 7e4f6fb51..000000000
--- a/Dockerfile.base
+++ /dev/null
@@ -1,21 +0,0 @@
-FROM python:slim
-
-WORKDIR /
-
-ENV LD_LIBRARY_PATH /usr/local/lib
-
-# Deps
-RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
- apt-get -qq update && \
- apt-get -qq install -y \
- libcurl4-openssl-dev \
- libcrypto++-dev libsqlite3-dev libc-ares-dev \
- libfreeimage-dev \
- libsodium-dev \
- libssl-dev \
- libmagic-dev && \
- apt-get install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils && \
- apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
- wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && \
- tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
- mv ff*/ff* /usr/local/bin/ && rm -rf ff*
diff --git a/extract b/bin/extract
similarity index 100%
rename from extract
rename to bin/extract
diff --git a/pextract b/bin/pextract
similarity index 100%
rename from pextract
rename to bin/pextract
diff --git a/bot/__init__.py b/bot/__init__.py
index 7f53f0f1b..756cf6675 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -4,12 +4,18 @@
import time
import random
import string
+import subprocess
+import pkgutil
+import pathlib
+import sys
import aria2p
+import requests
import telegram.ext as tg
from dotenv import load_dotenv
from pyrogram import Client
from telegraph import Telegraph
+from megasdkrestclient import MegaSdkRestClient, errors as mega_err
import socket
import faulthandler
@@ -43,6 +49,35 @@ def getConfig(name: str):
exit()
except KeyError:
pass
+CWD = os.getcwd()
+ariaconfig = pkgutil.get_data("bot", "data/aria.conf").decode()
+dhtfile = pkgutil.get_data("bot", "data/dht.dat")
+dht6file = pkgutil.get_data("bot", "data/dht6.dat")
+with open("dht.dat", "wb+") as dht:
+ dht.write(dhtfile)
+with open("dht6.dat", "wb+") as dht6:
+ dht6.write(dhtfile)
+ariaconfig = ariaconfig.replace("/currentwd", str(CWD))
+try:
+ max_dl = getConfig("MAX_CONCURRENT_DOWNLOADS")
+except KeyError:
+ max_dl = "4"
+tracker_list = requests.get("https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all_aria2.txt").text
+ariaconfig += f"\nmax-concurrent-downloads={max_dl}\nbt-tracker={tracker_list}"
+
+with open("aria.conf", "w+") as ariaconf:
+ ariaconf.write(ariaconfig)
+
+ARIA_CHILD_PROC = None
+try:
+ ARIA_CHILD_PROC = subprocess.Popen(["aria2c", f"--conf-path={CWD}/aria.conf"])
+except FileNotFoundError:
+ LOGGER.error("Please install Aria2c, Exiting..")
+ sys.exit(0)
+except OSError:
+ LOGGER.error("Aria2c Binary might have got damaged, Please Check and reinstall..")
+ sys.exit(0)
+time.sleep(1)
aria2 = aria2p.API(
aria2p.Client(
@@ -85,6 +120,8 @@ def getConfig(name: str):
DOWNLOAD_DIR = getConfig('DOWNLOAD_DIR')
if not DOWNLOAD_DIR.endswith("/"):
DOWNLOAD_DIR = DOWNLOAD_DIR + '/'
+ if not os.path.exists(DOWNLOAD_DIR):
+ os.makedirs(DOWNLOAD_DIR, 0o777)
DOWNLOAD_STATUS_UPDATE_INTERVAL = int(getConfig('DOWNLOAD_STATUS_UPDATE_INTERVAL'))
OWNER_ID = int(getConfig('OWNER_ID'))
AUTO_DELETE_MESSAGE_DURATION = int(getConfig('AUTO_DELETE_MESSAGE_DURATION'))
@@ -92,7 +129,8 @@ def getConfig(name: str):
TELEGRAM_HASH = getConfig('TELEGRAM_HASH')
except KeyError as e:
LOGGER.error("One or more env variables missing! Exiting now")
- exit(1)
+ sys.exit()
+ # exit()
LOGGER.info("Generating USER_SESSION_STRING")
app = Client(':memory:', api_id=int(TELEGRAM_API), api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN)
@@ -110,19 +148,43 @@ def getConfig(name: str):
except KeyError:
logging.warning('UPTOBOX_TOKEN not provided!')
UPTOBOX_TOKEN = None
+
try:
- MEGA_API_KEY = getConfig('MEGA_API_KEY')
-except KeyError:
- logging.warning('MEGA API KEY not provided!')
- MEGA_API_KEY = None
-try:
- MEGA_EMAIL_ID = getConfig('MEGA_EMAIL_ID')
- MEGA_PASSWORD = getConfig('MEGA_PASSWORD')
- if len(MEGA_EMAIL_ID) == 0 or len(MEGA_PASSWORD) == 0:
- raise KeyError
+ MEGA_KEY = getConfig('MEGA_KEY')
except KeyError:
- logging.warning('MEGA Credentials not provided!')
- MEGA_EMAIL_ID = None
+ MEGA_KEY = None
+ LOGGER.info('MEGA API KEY NOT AVAILABLE')
+MEGA_CHILD_PROC = None
+if MEGA_KEY is not None:
+ try:
+ MEGA_CHILD_PROC = subprocess.Popen(["megasdkrest", "--apikey", MEGA_KEY])
+ except FileNotFoundError:
+ LOGGER.error("Please install Megasdkrest Binary, Exiting..")
+ sys.exit(0)
+ except OSError:
+ LOGGER.error("Megasdkrest Binary might have got damaged, Please Check ..")
+ sys.exit(0)
+ time.sleep(3)
+ mega_client = MegaSdkRestClient('http://localhost:6090')
+ try:
+ MEGA_USERNAME = getConfig('MEGA_USERNAME')
+ MEGA_PASSWORD = getConfig('MEGA_PASSWORD')
+ if len(MEGA_USERNAME) > 0 and len(MEGA_PASSWORD) > 0:
+ try:
+ mega_client.login(MEGA_USERNAME, MEGA_PASSWORD)
+ except mega_err.MegaSdkRestClientException as e:
+ logging.error(e.message['message'])
+ exit(0)
+ else:
+ LOGGER.info("Mega API KEY provided but credentials not provided. Starting mega in anonymous mode!")
+ MEGA_USERNAME = None
+ MEGA_PASSWORD = None
+ except KeyError:
+ LOGGER.info("Mega API KEY provided but credentials not provided. Starting mega in anonymous mode!")
+ MEGA_USERNAME = None
+ MEGA_PASSWORD = None
+else:
+ MEGA_USERNAME = None
MEGA_PASSWORD = None
try:
INDEX_URL = getConfig('INDEX_URL')
diff --git a/aria.conf b/bot/data/aria.conf
similarity index 88%
rename from aria.conf
rename to bot/data/aria.conf
index 7b7326fca..b3a6a2ce5 100644
--- a/aria.conf
+++ b/bot/data/aria.conf
@@ -13,7 +13,8 @@ disable-ipv6=true
split=10
# Aria
-daemon=true
+# daemon=true
+quiet=true
allow-overwrite=true
file-allocation=prealloc
@@ -35,8 +36,8 @@ peer-id-prefix=-qB4350-
dht-listen-port=51513
enable-dht=true
enable-dht6=false
-dht-file-path=/app/dht.dat
-dht-file-path6=/app/dht6.dat
+dht-file-path=/currentwd/dht.dat
+dht-file-path6=/currentwd/dht6.dat
dht-entry-point=dht.transmissionbt.com:6881
dht-entry-point6=dht.transmissionbt.com:6881
diff --git a/bot/data/dht.dat b/bot/data/dht.dat
new file mode 100644
index 0000000000000000000000000000000000000000..a834b77711f0f2306dd010dd9dda8a3cea230439
GIT binary patch
literal 70616
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
z
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
literal 0
HcmV?d00001
diff --git a/bot/data/dht6.dat b/bot/data/dht6.dat
new file mode 100644
index 0000000000000000000000000000000000000000..36d34dbd8ad8757c6494ac7c889acf5d8177c3cd
GIT binary patch
literal 8960
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 str:
- return self.obj.name
-
- def progress_raw(self):
- try:
- return round(self.processed_bytes() / self.obj.size * 100,2)
- except ZeroDivisionError:
- return 0.0
-
- def progress(self):
- """Progress of download in percentage"""
- return f"{self.progress_raw()}%"
+ def gid(self):
+ return self.obj.gid
- def status(self) -> str:
- return MirrorStatus.STATUS_DOWNLOADING
+ def path(self):
+ return f"{DOWNLOAD_DIR}{self.uid}"
def processed_bytes(self):
return self.obj.downloaded_bytes
- def eta(self):
- try:
- seconds = (self.size_raw() - self.processed_bytes()) / self.speed_raw()
- return f'{get_readable_time(seconds)}'
- except ZeroDivisionError:
- return '-'
-
def size_raw(self):
return self.obj.size
- def size(self) -> str:
+ def size(self):
return get_readable_file_size(self.size_raw())
- def downloaded(self) -> str:
- return get_readable_file_size(self.obj.downloadedBytes)
+ def status(self):
+ return MirrorStatus.STATUS_DOWNLOADING
- def speed_raw(self):
- return self.obj.speed
+ def name(self):
+ return self.obj.name
- def speed(self) -> str:
- return f'{get_readable_file_size(self.speed_raw())}/s'
+ def progress_raw(self):
+ return self.obj.progress
- def gid(self) -> str:
- return self.obj.gid
+ def progress(self):
+ return f'{round(self.progress_raw(), 2)}%'
- def path(self) -> str:
- return f"{DOWNLOAD_DIR}{self.uid}"
+ def speed_raw(self):
+ """
+ :return: Download speed in Bytes/Seconds
+ """
+ return self.obj.download_speed
+
+ def speed(self):
+ return f'{get_readable_file_size(self.speed_raw())}/s'
+
+ def eta(self):
+ try:
+ seconds = (self.size_raw() - self.processed_bytes()) / self.speed_raw()
+ return f'{get_readable_time(seconds)}'
+ except ZeroDivisionError:
+ return '-'
def download(self):
return self.obj
\ No newline at end of file
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index ad7044c22..5894a7e7b 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -767,7 +767,7 @@ def download_folder(self, folder_id, path, folder_name):
def download_file(self, file_id, path, filename, mime_type):
request = self.__service.files().get_media(fileId=file_id)
fh = io.FileIO('{}{}'.format(path, filename), 'wb')
- downloader = MediaIoBaseDownload(fh, request, chunksize = 100 * 1024 * 1024)
+ downloader = MediaIoBaseDownload(fh, request, chunksize = 65 * 1024 * 1024)
done = False
while done is False:
if self.is_cancelled:
diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py
index 046bad1e1..9589629d2 100644
--- a/bot/helper/telegram_helper/bot_commands.py
+++ b/bot/helper/telegram_helper/bot_commands.py
@@ -1,25 +1,34 @@
+import os
+
+def getCommand(name: str, command: str):
+ try:
+ if len(os.environ[name]) == 0:
+ raise KeyError
+ return os.environ[name]
+ except KeyError:
+ return command
class _BotCommands:
def __init__(self):
- self.StartCommand = 'start'
- self.MirrorCommand = 'mirror'
- self.UnzipMirrorCommand = 'unzipmirror'
- self.TarMirrorCommand = 'tarmirror'
- self.CancelMirror = 'cancel'
- self.CancelAllCommand = 'cancelall'
- self.ListCommand = 'list'
- self.SpeedCommand = 'speedtest'
- self.CountCommand = 'count'
- self.StatusCommand = 'status'
- self.AuthorizeCommand = 'authorize'
- self.UnAuthorizeCommand = 'unauthorize'
- self.PingCommand = 'ping'
- self.RestartCommand = 'restart'
- self.StatsCommand = 'stats'
- self.HelpCommand = 'help'
- self.LogCommand = 'log'
- self.CloneCommand = "clone"
- self.WatchCommand = 'watch'
- self.TarWatchCommand = 'tarwatch'
- self.deleteCommand = 'del'
+ self.StartCommand = getCommand('START_COMMAND', 'start')
+ self.MirrorCommand = getCommand('MIRROR_COMMAND', 'mirror')
+ self.UnzipMirrorCommand = getCommand('UNZIP_COMMAND', 'unzipmirror')
+ self.TarMirrorCommand = getCommand('TAR_COMMAND', 'tarmirror')
+ self.CancelMirror = getCommand('CANCEL_COMMAND', 'cancel')
+ self.CancelAllCommand = getCommand('CANCELALL_COMMAND', 'cancelall')
+ self.ListCommand = getCommand('LIST_COMMAND', 'list')
+ self.SpeedCommand = getCommand('SPEED_COMMAND', 'speedtest')
+ self.CountCommand = getCommand('COUNT_COMMAND', 'count')
+ self.StatusCommand = getCommand('STATUS_COMMAND', 'status')
+ self.AuthorizeCommand = getCommand('AUTH_COMMAND', 'authorize')
+ self.UnAuthorizeCommand = getCommand('UNAUTH_COMMAND', 'unauthorize')
+ self.PingCommand = getCommand('PING_COMMAND', 'ping')
+ self.RestartCommand = getCommand('RESTART_COMMAND', 'restart')
+ self.StatsCommand = getCommand('STATS_COMMAND', 'stats')
+ self.HelpCommand = getCommand('HELP_COMMAND', 'help')
+ self.LogCommand = getCommand('LOG_COMMAND', 'log')
+ self.CloneCommand = getCommand('CLONE_COMMAND', 'clone')
+ self.WatchCommand = getCommand('WATCH_COMMAND', 'watch')
+ self.TarWatchCommand = getCommand('TARWATCH_COMMAND', 'tarwatch')
+ self.deleteCommand = getCommand('DELETE_COMMAND', 'del')
BotCommands = _BotCommands()
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 2375af932..858e1ebec 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -138,7 +138,6 @@ def sendStatusMessage(msg, bot):
except Exception as e:
LOGGER.error(str(e))
del status_reply_dict[msg.message.chat.id]
- pass
if len(progress) == 0:
progress = "Starting DL"
message = sendMessage(progress, bot, msg)
diff --git a/bot/modules/list.py b/bot/modules/list.py
index 81d0dd32e..9ed9bc7aa 100644
--- a/bot/modules/list.py
+++ b/bot/modules/list.py
@@ -20,6 +20,8 @@ def list_drive(update,context):
except IndexError:
sendMessage('send a search key along with command', context.bot, update)
+ except AttributeError:
+ pass
list_handler = CommandHandler(BotCommands.ListCommand, list_drive,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user, run_async=True)
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 606aeb2e3..9a7320242 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -2,13 +2,13 @@
from telegram.ext import CommandHandler
from telegram import InlineKeyboardMarkup
-from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
+from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS, MEGA_KEY
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock, SHORTENER, SHORTENER_API
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException, NotSupportedExtractionArchive
from bot.helper.mirror_utils.download_utils.aria2_download import AriaDownloadHelper
-from bot.helper.mirror_utils.download_utils.mega_downloader import MegaDownloadHelper
+from bot.helper.mirror_utils.download_utils.mega_download import MegaDownloader
from bot.helper.mirror_utils.download_utils.direct_link_generator import direct_link_generator
from bot.helper.mirror_utils.download_utils.telegram_downloader import TelegramDownloadHelper
from bot.helper.mirror_utils.status_utils import listeners
@@ -295,15 +295,15 @@ def _mirror(bot, update, isTar=False, extract=False):
sendStatusMessage(update, bot)
drive.download(link)
- elif bot_utils.is_mega_link(link):
+ elif bot_utils.is_mega_link(link) and MEGA_KEY is not None:
if BLOCK_MEGA_LINKS:
sendMessage("Mega Links Are Blocked ✋", bot, update)
else:
- mega_dl = MegaDownloadHelper()
- mega_dl.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener)
+ mega_dl = MegaDownloader(listener)
+ mega_dl.add_download(link, f'{DOWNLOAD_DIR}{listener.uid}/')
sendStatusMessage(update, bot)
else:
- ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}/{listener.uid}/', listener, name)
+ ariaDlManager.add_download(link, f'{DOWNLOAD_DIR}{listener.uid}/', listener, name)
sendStatusMessage(update, bot)
if len(Interval) == 0:
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
diff --git a/captain-definition b/captain-definition
deleted file mode 100644
index 0e14f8239..000000000
--- a/captain-definition
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "schemaVersion": 2,
- "dockerfilePath": "./Dockerfile"
-}
diff --git a/config_sample.env b/config_sample.env
index 2545045df..50057266c 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -9,19 +9,20 @@ AUTO_DELETE_MESSAGE_DURATION = 20
TELEGRAM_API =
TELEGRAM_HASH = ""
AUTHORIZED_CHATS = "" #Separated by space
+MAX_CONCURRENT_DOWNLOADS = 4
## Drive
GDRIVE_FOLDER_ID = ""
IS_TEAM_DRIVE = ""
INDEX_URL = ""
-DOWNLOAD_DIR = "/app/downloads"
+DOWNLOAD_DIR = "/app/downloads" # Dont change this if you are using Docker compose
USE_SERVICE_ACCOUNTS = ""
## Optional config
UPTOBOX_TOKEN = ""
-MEGA_API_KEY = "" # Get this from https://mega.nz/sdk
-MEGA_EMAIL_ID = ""
+MEGA_KEY = "" # Get this from https://mega.nz/sdk
+MEGA_USERNAME = ""
MEGA_PASSWORD = ""
BLOCK_MEGA_LINKS = ""
@@ -37,4 +38,29 @@ BUTTON_THREE_URL = ""
BUTTON_FOUR_NAME = ""
BUTTON_FOUR_URL = ""
BUTTON_FIVE_NAME = ""
-BUTTON_FIVE_URL = ""
\ No newline at end of file
+BUTTON_FIVE_URL = ""
+
+
+# Commands Customization (Completely Optional)
+# If you want to change
+START_COMMAND = ""
+MIRROR_COMMAND = ""
+UNZIP_COMMAND = ""
+TAR_COMMAND = ""
+CANCEL_COMMAND = ""
+CANCELALL_COMMAND = ""
+LIST_COMMAND = ""
+SPEED_COMMAND = ""
+COUNT_COMMAND = ""
+STATUS_COMMAND = ""
+AUTH_COMMAND = ""
+UNAUTH_COMMAND = ""
+PING_COMMAND = ""
+RESTART_COMMAND = ""
+STATS_COMMAND = ""
+HELP_COMMAND = ""
+LOG_COMMAND = ""
+CLONE_COMMAND = ""
+WATCH_COMMAND = ""
+TARWATCH_COMMAND = ""
+DELETE_COMMAND = ""
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 000000000..8348d9b90
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,21 @@
+version: "3.9"
+
+services:
+ mirrorx:
+ image: ghcr.io/iamliquidx/mirrorx:latest
+ container_name: mirrorx
+ env_file:
+ # Should be filled up and should be kept in the same directory
+ - config.env
+ volumes:
+ # Make a folder in the host OS and keep SA(accounts folder) or token there
+ # syntax "host OS path":"where it should be mounted inside container"
+ - /home/someuser/mirrorx/accounts:/app/accounts
+ # for Service Accounts ex: /home/someuser/mirrorx/accounts:/app/accounts
+ # for token and credential.json
+ # - /home/someuser/mirrorx/token.pickle:/app/token.pickle
+ # - /home/someuser/mirrorx/credential.json:/app/credentials.json
+ # Dont edit the Container Directory (i.e Right Side one) as the bot runs in the same directory
+
+ restart: unless-stopped
+ # Restart policy, if container exits due to some error it will restart again
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 14c162be3..d1e5e6f9d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,11 +14,11 @@ python-magic
beautifulsoup4
Pyrogram
TgCrypto
-psycopg2-binary
yt-dlp
lxml
telegraph
speedtest-cli
messages
pybase64
-lk21
\ No newline at end of file
+lk21
+megasdkrestclient
\ No newline at end of file
diff --git a/setup.py b/setup.py
new file mode 100644
index 000000000..7e7c02547
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,67 @@
+from setuptools import setup, find_packages
+import pathlib
+
+CWD = pathlib.Path(__file__).parent
+
+README = (CWD / "README.md").read_text()
+
+setup(
+ name='MirrorX',
+ version='5.9.9',
+ packages=find_packages(),
+ long_description=README,
+ long_description_content_type="text/markdown",
+ url='https://github.com/iamliquidx/mirrorx',
+ license='GPL3.0',
+ author='',
+ author_email='',
+ include_package_data=True,
+ description='Telegram Mirror Bot',
+ platforms="any",
+ install_requires=[
+ "requests",
+ "appdirs",
+ "aria2p",
+ "progress",
+ "psutil",
+ "python-telegram-bot",
+ "google-api-python-client",
+ "google-auth-httplib2",
+ "google-auth-oauthlib",
+ "js2py",
+ "python-dotenv",
+ "tenacity",
+ "python-magic",
+ "beautifulsoup4",
+ "Pyrogram",
+ "TgCrypto",
+ "yt-dlp",
+ "lxml",
+ "telegraph",
+ "speedtest-cli",
+ "messages",
+ "pybase64",
+ "lk21",
+ "megasdkrestclient"
+ ],
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "License :: OSI Approved :: GNU General Public License (GPL)",
+ "Operating System :: POSIX :: Linux",
+ "Development Status :: 5 - Production/Stable"
+ ],
+ python_requires=">=3.7",
+ entry_points={
+ "console_scripts":[
+ "MirrorX = bot.__main__:main"
+ ]
+
+ },
+ package_data={
+ "": ["data/*.dat", "data/aria.conf"],
+ },
+ scripts=['bin/extract', 'bin/pextract'],
+)
\ No newline at end of file
diff --git a/start.sh b/start.sh
deleted file mode 100755
index 2e02ebcf0..000000000
--- a/start.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-MEGA_VERSION=$(curl -s "https://api.github.com/repos/yzop/MegaSDK/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")' | sed -e 's/^v//')
-pip3 -q install https://github.com/yzop/MegaSDK/releases/download/v$MEGA_VERSION/megasdk-$MEGA_VERSION-py2.py3-none-any.whl
-LIB_VERSION="${MEGA_VERSION//./0}"
-if [[ -f "/usr/local/lib/python3.9/site-packages/mega/libmega.so" ]]; then
- ln -s /usr/local/lib/python3.9/site-packages/mega/libmega.so /usr/local/lib/libmega.so.$LIB_VERSION
-elif [[ -f "/app/.local/lib/python3.9/site-packages/mega/libmega.so" ]]; then
- ln -s /app/.local/lib/python3.9/site-packages/mega/libmega.so /usr/local/lib/libmega.so.$LIB_VERSION
-else
- echo "Mega Shared Object not found Exiting"
- exit 1
-fi
-pip3 -qq install --upgrade yt-dlp
-sed -n -i '/max-concurrent-downloads/q;p' /app/aria.conf
-tracker_list=`curl -Ns https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt | awk '$1' | tr '\n' ',' | cat`
-echo -e "\nmax-concurrent-downloads=4\nbt-tracker=$tracker_list" >> /app/aria.conf
-aria2c --conf-path=/app/aria.conf
-python3 -m bot
diff --git a/add_to_team_drive.py b/utils/add_to_team_drive.py
similarity index 100%
rename from add_to_team_drive.py
rename to utils/add_to_team_drive.py
diff --git a/gen_sa_accounts.py b/utils/gen_sa_accounts.py
similarity index 100%
rename from gen_sa_accounts.py
rename to utils/gen_sa_accounts.py
diff --git a/generate_drive_token.py b/utils/generate_drive_token.py
similarity index 100%
rename from generate_drive_token.py
rename to utils/generate_drive_token.py
diff --git a/vendor/cmrudl.py b/vendor/cmrudl.py
deleted file mode 160000
index f7d75bcf7..000000000
--- a/vendor/cmrudl.py
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit f7d75bcf7901aee7b1430fc17366b7b6af65235e
From a7a025d5ae1c83bbc49c5a3fe8af2140b4425e28 Mon Sep 17 00:00:00 2001
From: Nenokkadine
Date: Fri, 2 Jul 2021 22:17:49 +0530
Subject: [PATCH 178/190] Fix Python Version not available
---
.github/workflows/release.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 83d78f9ae..e24473931 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,7 +13,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
- python-version: 3.9.6
+ python-version: 3.9.5
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
From 5a1316cc7ef1a611a173d6014bb91c2a3d6426f7 Mon Sep 17 00:00:00 2001
From: Nenokkadine
Date: Fri, 2 Jul 2021 22:46:19 +0530
Subject: [PATCH 179/190] Fix GCC not found error in arm64
---
.github/workflows/release.yml | 2 +-
Dockerfile | 5 ++++-
setup.py | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e24473931..8f4d2223b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -57,7 +57,7 @@ jobs:
images: ghcr.io/iamliquidx/mirrorx
tags: |
type=semver,pattern={{version}}
- - name: Build and push LTS RAW
+ - name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
diff --git a/Dockerfile b/Dockerfile
index 360999515..a609dcc27 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,7 +9,7 @@ RUN if [ "$(uname -m)" = "aarch64" ] ; then \
fi && \
sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
apt-get -qq update && \
- apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev && \
+ apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev gcc && \
apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
@@ -18,6 +18,9 @@ RUN if [ "$(uname -m)" = "aarch64" ] ; then \
chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/
RUN pip3 install --no-cache-dir MirrorX
+
+RUN apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
+
WORKDIR /app
CMD ["MirrorX"]
diff --git a/setup.py b/setup.py
index 7e7c02547..540e1fde8 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='5.9.9',
+ version='6.0.0',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
From 1f3ec6471fb12bc9c458ff13682e4b05c3d2bc8c Mon Sep 17 00:00:00 2001
From: Nenokkadine
Date: Sat, 3 Jul 2021 08:29:53 +0530
Subject: [PATCH 180/190] Add an Example how to mount netrc in container
---
docker-compose.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docker-compose.yml b/docker-compose.yml
index 8348d9b90..27b72f5ee 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,6 +15,8 @@ services:
# for token and credential.json
# - /home/someuser/mirrorx/token.pickle:/app/token.pickle
# - /home/someuser/mirrorx/credential.json:/app/credentials.json
+ # Incase you want to add a netrc file to youtube-dl
+ # - /home/someuser/mirrorx/netrc:/root/.netrc
# Dont edit the Container Directory (i.e Right Side one) as the bot runs in the same directory
restart: unless-stopped
From 955d2db109b884705422a4bc9c3d05d7d11dc422 Mon Sep 17 00:00:00 2001
From: Nenokkadine
Date: Sat, 7 Aug 2021 21:49:19 +0530
Subject: [PATCH 181/190] Update Script and MegaSDKREST
Add another command `MirrorXBot` and Old Command `MirrorX` will Update the package and Start the Bot
---
.github/workflows/release.yml | 4 ++--
.gitignore | 3 ++-
Dockerfile | 10 ++++-----
bin/MirrorX | 3 +++
setup.py | 40 +++++++++++++++++------------------
5 files changed, 31 insertions(+), 29 deletions(-)
create mode 100644 bin/MirrorX
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8f4d2223b..fd20fec89 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,7 +13,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
- python-version: 3.9.5
+ python-version: 3.9.6
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
@@ -40,7 +40,7 @@ jobs:
run: sleep 60
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- with:
+ with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
diff --git a/.gitignore b/.gitignore
index 1fc1cd804..ac258eaab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,4 +16,5 @@ aria.conf
dht.dat
build
dist
-*.spec
\ No newline at end of file
+*.spec
+/venv/
diff --git a/Dockerfile b/Dockerfile
index a609dcc27..d3aa455b7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,12 +14,10 @@ RUN if [ "$(uname -m)" = "aarch64" ] ; then \
wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
mv ff*/ff* /usr/local/bin/ && rm -rf ff* && \
- wget -q https://github.com/viswanathbalusu/megasdkrest/releases/download/v0.1.0/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
- chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/
-
-RUN pip3 install --no-cache-dir MirrorX
-
-RUN apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
+ wget -q https://github.com/viswanathbalusu/megasdkrest/releases/download/v0.1.1/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
+ chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/ && \
+ pip3 install --no-cache-dir MirrorX && \
+ apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
WORKDIR /app
diff --git a/bin/MirrorX b/bin/MirrorX
new file mode 100644
index 000000000..7c40066fb
--- /dev/null
+++ b/bin/MirrorX
@@ -0,0 +1,3 @@
+#!/bin/bash
+pip3 install -U MirrorX
+MirrorXBot
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 540e1fde8..f004b5439 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.0',
+ version='6.0.1',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
@@ -19,29 +19,29 @@
description='Telegram Mirror Bot',
platforms="any",
install_requires=[
- "requests",
- "appdirs",
- "aria2p",
- "progress",
- "psutil",
- "python-telegram-bot",
+ "requests==2.26.0",
+ "appdirs==1.4.4",
+ "aria2p==0.10.4",
+ "progress==1.6",
+ "psutil==5.8.0",
+ "python-telegram-bot==13.7",
"google-api-python-client",
"google-auth-httplib2",
"google-auth-oauthlib",
- "js2py",
- "python-dotenv",
- "tenacity",
- "python-magic",
- "beautifulsoup4",
+ "js2py==0.71",
+ "python-dotenv==0.19.0",
+ "tenacity==8.0.1",
+ "python-magic==0.4.24",
+ "beautifulsoup4==4.9.3",
"Pyrogram",
"TgCrypto",
"yt-dlp",
- "lxml",
- "telegraph",
- "speedtest-cli",
- "messages",
- "pybase64",
- "lk21",
+ "lxml==4.6.3",
+ "telegraph==1.4.1",
+ "speedtest-cli==2.1.3",
+ "messages==0.5.0",
+ "pybase64==1.1.4",
+ "lk21==1.6.0",
"megasdkrestclient"
],
classifiers=[
@@ -56,12 +56,12 @@
python_requires=">=3.7",
entry_points={
"console_scripts":[
- "MirrorX = bot.__main__:main"
+ "MirrorXBot = bot.__main__:main"
]
},
package_data={
"": ["data/*.dat", "data/aria.conf"],
},
- scripts=['bin/extract', 'bin/pextract'],
+ scripts=['bin/extract', 'bin/pextract', 'bin/MirrorX'],
)
\ No newline at end of file
From 00cf61e91d40a3d4bb36cecb95a66b3763b6cb41 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 11:22:56 +0530
Subject: [PATCH 182/190] Some fixes. RGB removed.
fix to error 404 that was appearing sometime. rgb removed.
---
bot/__main__.py | 20 ++++----
bot/helper/ext_utils/bot_utils.py | 34 ++++++-------
.../download_utils/aria2_download.py | 6 +--
.../mirror_utils/upload_utils/gdriveTools.py | 50 +++++++++----------
bot/modules/mirror.py | 14 +++---
requirements.txt | 40 +++++++--------
setup.py | 8 +--
7 files changed, 86 insertions(+), 86 deletions(-)
diff --git a/bot/__main__.py b/bot/__main__.py
index cf7aa5972..5242d529d 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -29,15 +29,15 @@ def stats(update, context):
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
- stats = f'Bot Uptime ⌚: {currentTime}\n' \
- f'Total disk space🗄️: {total}\n' \
- f'Used 🗃️: {used} ' \
- f'Free 🗃️: {free}\n\n' \
- f'📇Data Usage📇\nUploaded : {sent}\n' \
- f'Downloaded: {recv}\n\n' \
- f'CPU 🖥️: {cpuUsage}% ' \
- f'RAM ⛏️: {memory}% ' \
- f'Disk 🗄️: {disk}%'
+ stats = f'Bot Uptime:- {currentTime}\n' \
+ f'Total Disk Space:- {total}\n' \
+ f'Used:- {used} ' \
+ f'Free:- {free}\n\n' \
+ f'Data Usage\nUp:- {sent}\n' \
+ f'Down:- {recv}\n\n' \
+ f'CPU: {cpuUsage}% ' \
+ f'RAM: {memory}% ' \
+ f'Disk: {disk}%'
sendMessage(stats, context.bot, update)
@@ -74,7 +74,7 @@ def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
-/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to google drive.\nPlzzz see this for full use of this command https://telegra.ph/Magneto-Python-Aria---Custom-Filename-Examples-01-20
+/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to google drive.\n
/{BotCommands.UnzipMirrorCommand} [download_url][magnet_link] : starts mirroring and if downloaded file is any archive , extracts it to google drive
diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py
index 600c76d54..2de4b3ca8 100644
--- a/bot/helper/ext_utils/bot_utils.py
+++ b/bot/helper/ext_utils/bot_utils.py
@@ -14,17 +14,17 @@
class MirrorStatus:
- STATUS_UPLOADING = "Uploading...⏫"
- STATUS_DOWNLOADING = "Downloading...⏬"
- STATUS_WAITING = "Queued...📝"
- STATUS_FAILED = "Failed 🚫. Cleaning download"
- STATUS_CANCELLED = "Cancelled ❎"
- STATUS_ARCHIVING = "Archiving...🔐"
- STATUS_EXTRACTING = "Extracting...📂"
+ STATUS_UPLOADING = "Uploading"
+ STATUS_DOWNLOADING = "Downloading"
+ STATUS_WAITING = "Queued"
+ STATUS_FAILED = "Failed.Cleaning download"
+ STATUS_CANCELLED = "Cancelled "
+ STATUS_ARCHIVING = "Archiving"
+ STATUS_EXTRACTING = "Extracting"
PROGRESS_MAX_SIZE = 100 // 8
-PROGRESS_INCOMPLETE = ['▓', '▓', '▓', '▓', '▓', '▓', '▓']
+PROGRESS_INCOMPLETE = ['█', '█', '█', '█', '█', '█', '█']
SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
@@ -81,7 +81,7 @@ def get_progress_bar_string(status):
p = min(max(p, 0), 100)
cFull = p // 8
cPart = p % 8 - 1
- p_str = '▓' * cFull
+ p_str = '█' * cFull
if cPart >= 0:
p_str += PROGRESS_INCOMPLETE[cPart]
p_str += '░' * (PROGRESS_MAX_SIZE - cFull)
@@ -93,23 +93,23 @@ def get_readable_message():
with download_dict_lock:
msg = ""
for download in list(download_dict.values()):
- msg += f"📂Filename : {download.name()}"
- msg += f"\nStatus : {download.status()}"
+ msg += f"Name:- {download.name()}"
+ msg += f"\nStatus:- {download.status()}"
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n{get_progress_bar_string(download)} {download.progress()}"
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nDownloaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nDownloaded:- {get_readable_file_size(download.processed_bytes())} of {download.size()}"
else:
- msg += f"\nUploaded : {get_readable_file_size(download.processed_bytes())} of {download.size()}"
- msg += f"\nSpeed ⚡️: {download.speed()}, \nETA ⏳:- {download.eta()} "
+ msg += f"\nUploaded:- {get_readable_file_size(download.processed_bytes())} of {download.size()}"
+ msg += f"\nSpeed:- {download.speed()}, \nETA:- {download.eta()} "
# if hasattr(download, 'is_torrent'):
try:
- msg += f"\nInfo ⚓️ :- Seeders: {download.aria_download().num_seeders}" \
- f" & Peers : {download.aria_download().connections}"
+ msg += f"\nInfo: Seeders:- {download.aria_download().num_seeders}" \
+ f" & Peers:- {download.aria_download().connections}"
except:
pass
if download.status() == MirrorStatus.STATUS_DOWNLOADING:
- msg += f"\nTo Stop 👉 : /{BotCommands.CancelMirror} {download.gid()}"
+ msg += f"\nTo Stop:- /{BotCommands.CancelMirror} {download.gid()}"
msg += "\n\n"
return msg
diff --git a/bot/helper/mirror_utils/download_utils/aria2_download.py b/bot/helper/mirror_utils/download_utils/aria2_download.py
index d548fc0e1..defdca6c4 100644
--- a/bot/helper/mirror_utils/download_utils/aria2_download.py
+++ b/bot/helper/mirror_utils/download_utils/aria2_download.py
@@ -31,8 +31,8 @@ def __onDownloadStarted(self, api, gid):
gdrive = GoogleDriveHelper(None)
smsg, button = gdrive.drive_list(sname)
if smsg:
- dl.getListener().onDownloadError(f'😡😡File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
- sendMarkup(" Here are the search results:👇👇", dl.getListener().bot, dl.getListener().update, button)
+ dl.getListener().onDownloadError(f'File is already available in drive.This download has been stopped.\n\n')
+ sendMarkup("Here are the search results:", dl.getListener().bot, dl.getListener().update, button)
aria2.remove([download])
return
update_all_messages()
@@ -62,7 +62,7 @@ def __onDownloadPause(self, api, gid):
def __onDownloadStopped(self, api, gid):
LOGGER.info(f"onDownloadStop: {gid}")
dl = getDownloadByGid(gid)
- if dl: dl.getListener().onDownloadError('Download stopped by user!')
+ if dl: dl.getListener().onDownloadError('Your torrent has no seeds.Download stopped automatically.')
@new_thread
def __onDownloadError(self, api, gid):
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 5894a7e7b..149a56a17 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -115,7 +115,7 @@ def __upload_empty_file(self, path, file_name, mime_type, parent_id=None):
resumable=False)
file_metadata = {
'name': file_name,
- 'description': 'mirror',
+ 'description': 'mirrored',
'mimeType': mime_type,
}
if parent_id is not None:
@@ -237,7 +237,7 @@ def upload(self, file_name: str):
link = self.upload_file(file_path, file_name, mime_type, parent_id)
if link is None:
raise Exception('Upload has been manually cancelled')
- LOGGER.info("Uploaded To G-Drive: " + file_path)
+ LOGGER.info("Uploaded To G-Drive:- " + file_path)
except Exception as e:
if isinstance(e, RetryError):
LOGGER.info(f"Total Attempts: {e.last_attempt.attempt_number}")
@@ -337,22 +337,22 @@ def clone(self, link):
if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
- msg += f'Filename : {meta.get("name")}\nSize : {get_readable_file_size(self.transferred_size)}'
+ msg += f'Name:- {meta.get("name")}\nSize:- {get_readable_file_size(self.transferred_size)}'
durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text
- buttons.buildbutton("⚡Drive Link⚡", surl)
+ buttons.buildbutton("Drive Link", surl)
else:
- buttons.buildbutton("⚡Drive Link⚡", durl)
+ buttons.buildbutton("Drive Link", durl)
if INDEX_URL is not None:
url_path = requests.utils.quote(f'{meta.get("name")}')
url = f'{INDEX_URL}/{url_path}/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
- buttons.buildbutton("💥Index Link💥", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("💥Index Link💥", url)
+ buttons.buildbutton("Index Link", url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
@@ -361,16 +361,16 @@ def clone(self, link):
buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
else:
file = self.copyFile(meta.get('id'), parent_id)
- msg += f'Filename : {file.get("name")}'
+ msg += f'Name:- {file.get("name")}'
durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id"))
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text
- buttons.buildbutton("⚡Drive Link⚡", surl)
+ buttons.buildbutton("Drive Link", surl)
else:
- buttons.buildbutton("⚡Drive Link⚡", durl)
+ buttons.buildbutton("Drive Link", durl)
try:
- msg += f'\nSize : {get_readable_file_size(int(meta.get("size")))}'
+ msg += f'\nSize:- {get_readable_file_size(int(meta.get("size")))}'
except TypeError:
pass
if INDEX_URL is not None:
@@ -378,9 +378,9 @@ def clone(self, link):
url = f'{INDEX_URL}/{url_path}'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text
- buttons.buildbutton("💥Index Link💥", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("💥Index Link💥", url)
+ buttons.buildbutton("Index Link", url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
@@ -389,7 +389,7 @@ def clone(self, link):
buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
except Exception as err:
if isinstance(err, RetryError):
- LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
+ LOGGER.info(f"Total Attempts:- {err.last_attempt.attempt_number}")
err = err.last_attempt.exception()
err = str(err).replace('>', '').replace('<', '')
LOGGER.error(err)
@@ -533,7 +533,7 @@ def drive_list(self, fileName):
for file in response.get('files', []):
if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
furl = f"https://drive.google.com/drive/folders/{file.get('id')}"
- msg += f"⁍{file.get('name')}
(folder📁)
"
+ msg += f"⁍{file.get('name')}
(folder)
"
if SHORTENER is not None and SHORTENER_API is not None:
sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
@@ -549,7 +549,7 @@ def drive_list(self, fileName):
msg += f' | Index Link'
else:
furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download"
- msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
"
+ msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})
"
if SHORTENER is not None and SHORTENER_API is not None:
sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
@@ -617,13 +617,13 @@ def count(self, link):
LOGGER.info(f"Counting: {name}")
if drive_file['mimeType'] == self.__G_DRIVE_DIR_MIME_TYPE:
self.gDrive_directory(**drive_file)
- msg += f'Name : {name}'
- msg += f'\nSize : {get_readable_file_size(self.total_bytes)}'
- msg += f"\nType : Folder"
- msg += f"\nSubFolders : {self.total_folders}"
- msg += f"\nFiles : {self.total_files}"
+ msg += f'Name:- {name}'
+ msg += f'\nSize:- {get_readable_file_size(self.total_bytes)}'
+ msg += f"\nType:- Folder"
+ msg += f"\nSubFolders:- {self.total_folders}"
+ msg += f"\nFiles:- {self.total_files}"
else:
- msg += f'Filename : {name}'
+ msg += f'Name:- {name}'
try:
typee = drive_file['mimeType']
except:
@@ -631,9 +631,9 @@ def count(self, link):
try:
self.total_files += 1
self.gDrive_file(**drive_file)
- msg += f'\nSize : {get_readable_file_size(self.total_bytes)}'
- msg += f"\nType : {typee}"
- msg += f"\nFiles : {self.total_files}"
+ msg += f'\nSize:- {get_readable_file_size(self.total_bytes)}'
+ msg += f"\nType:- {typee}"
+ msg += f"\nFiles:- {self.total_files}"
except TypeError:
pass
except Exception as err:
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 9a7320242..fe7ff363d 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -152,13 +152,13 @@ def onUploadProgress(self):
def onUploadComplete(self, link: str, size):
with download_dict_lock:
- msg = f'Filename : {download_dict[self.uid].name()}\nSize : {size}'
+ msg = f'Name:- {download_dict[self.uid].name()}\nSize:- {size}'
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text').text
- buttons.buildbutton("💾Drive Link💾", surl)
+ buttons.buildbutton("Drive Link", surl)
else:
- buttons.buildbutton("💾Drive Link💾", link)
+ buttons.buildbutton("Drive Link", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
url_path = requests.utils.quote(f'{download_dict[self.uid].name()}')
@@ -167,9 +167,9 @@ def onUploadComplete(self, link: str, size):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text').text
- buttons.buildbutton("🚀Index Link🚀", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("🚀Index Link🚀", share_url)
+ buttons.buildbutton("Index Link", share_url)
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
@@ -181,7 +181,7 @@ def onUploadComplete(self, link: str, size):
else:
uname = f'{self.message.from_user.first_name}'
if uname is not None:
- msg += f'\n\nReq. By 👉 : {uname}'
+ msg += f'\n\nReq. By:- {uname}'
try:
fs_utils.clean_download(download_dict[self.uid].path())
except FileNotFoundError:
@@ -297,7 +297,7 @@ def _mirror(bot, update, isTar=False, extract=False):
elif bot_utils.is_mega_link(link) and MEGA_KEY is not None:
if BLOCK_MEGA_LINKS:
- sendMessage("Mega Links Are Blocked ✋", bot, update)
+ sendMessage("Mega Links Are Blocked.", bot, update)
else:
mega_dl = MegaDownloader(listener)
mega_dl.add_download(link, f'{DOWNLOAD_DIR}{listener.uid}/')
diff --git a/requirements.txt b/requirements.txt
index d1e5e6f9d..cbc8ef944 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,24 +1,24 @@
-requests
-appdirs
-aria2p
-progress
-psutil
-python-telegram-bot
-google-api-python-client
-google-auth-httplib2
-google-auth-oauthlib
-js2py
-python-dotenv
-tenacity
-python-magic
-beautifulsoup4
+requests==2.26.0
+appdirs==1.4.4
+aria2p==0.10.4
+progress==1.6
+psutil==5.8.0
+python-telegram-bot==13.7
+google-api-python-client==2.11.0
+google-auth-httplib2==0.1.0
+google-auth-oauthlib==0.4.5
+js2py==0.71
+python-dotenv==0.19.0
+tenacity==8.0.1
+python-magic==0.4.24
+beautifulsoup4==4.9.3
Pyrogram
TgCrypto
yt-dlp
-lxml
-telegraph
-speedtest-cli
-messages
-pybase64
-lk21
+lxml==4.6.3
+telegraph==1.4.1
+speedtest-cli==2.1.3
+messages==0.5.0
+pybase64==1.1.4
+lk21==1.6.0
megasdkrestclient
\ No newline at end of file
diff --git a/setup.py b/setup.py
index f004b5439..3da1e134b 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.1',
+ version='6.0.2',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
@@ -25,9 +25,9 @@
"progress==1.6",
"psutil==5.8.0",
"python-telegram-bot==13.7",
- "google-api-python-client",
- "google-auth-httplib2",
- "google-auth-oauthlib",
+ "google-api-python-client==2.11.0",
+ "google-auth-httplib2==0.1.0",
+ "google-auth-oauthlib==0.4.5",
"js2py==0.71",
"python-dotenv==0.19.0",
"tenacity==8.0.1",
From 8aa98942650a24302c6a95e2f7467be55fa494fa Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 13:57:17 +0530
Subject: [PATCH 183/190] fixing build error
---
.github/workflows/release.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fd20fec89..8a755c796 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,7 +13,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
- python-version: 3.9.6
+ python-version: 3.8.11
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
@@ -65,4 +65,4 @@ jobs:
platforms: linux/amd64, linux/arm64/v8
push: true
tags: ${{ steps.metaraw.outputs.tags }}
- labels: ${{ steps.metaraw.outputs.labels }}
\ No newline at end of file
+ labels: ${{ steps.metaraw.outputs.labels }}
From 184d5ae5265e93614ebdfa19fa004f31d9f4fe2f Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 14:01:08 +0530
Subject: [PATCH 184/190] version bump
For build error fix
---
setup.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 3da1e134b..0280b05b6 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.2',
+ version='6.0.3',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
@@ -64,4 +64,4 @@
"": ["data/*.dat", "data/aria.conf"],
},
scripts=['bin/extract', 'bin/pextract', 'bin/MirrorX'],
-)
\ No newline at end of file
+)
From 4820af0ac5043c7da6ba47ddd6bc9c509b9f35b1 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 15:19:54 +0530
Subject: [PATCH 185/190] Removing some residue
---
bot/helper/telegram_helper/message_utils.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py
index 858e1ebec..cc1a82663 100644
--- a/bot/helper/telegram_helper/message_utils.py
+++ b/bot/helper/telegram_helper/message_utils.py
@@ -73,9 +73,9 @@ def delete_all_messages():
def update_all_messages():
msg = get_readable_message()
- msg += f"🖥️CPU: {psutil.cpu_percent()}%" \
- f" 📀DISK: {psutil.disk_usage('/').percent}%" \
- f" 📝RAM: {psutil.virtual_memory().percent}%"
+ msg += f"CPU:- {psutil.cpu_percent()}%" \
+ f" DISK:- {psutil.disk_usage('/').percent}%" \
+ f" RAM:- {psutil.virtual_memory().percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@@ -93,7 +93,7 @@ def update_all_messages():
uldl_bytes += float(speedy.split('M')[0]) * 1048576
dlspeed = get_readable_file_size(dlspeed_bytes)
ulspeed = get_readable_file_size(uldl_bytes)
- msg += f"\nDL:{dlspeed}ps ⏬| UL:{ulspeed}ps ⏫\n"
+ msg += f"\nDL:{dlspeed}ps | UL:{ulspeed}ps \n"
with status_reply_dict_lock:
for chat_id in list(status_reply_dict.keys()):
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
@@ -108,9 +108,9 @@ def update_all_messages():
def sendStatusMessage(msg, bot):
progress = get_readable_message()
- progress += f"💻CPU: {psutil.cpu_percent()}%" \
- f" 💽DISK: {psutil.disk_usage('/').percent}%" \
- f" 📝RAM: {psutil.virtual_memory().percent}%"
+ progress += f"CPU: {psutil.cpu_percent()}%" \
+ f" DISK: {psutil.disk_usage('/').percent}%" \
+ f" RAM: {psutil.virtual_memory().percent}%"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@@ -128,7 +128,7 @@ def sendStatusMessage(msg, bot):
uldl_bytes += float(speedy.split('M')[0]) * 1048576
dlspeed = get_readable_file_size(dlspeed_bytes)
ulspeed = get_readable_file_size(uldl_bytes)
- progress += f"\nDL:{dlspeed}ps 🔻| UL:{ulspeed}ps 🔺\n"
+ progress += f"\nDL:{dlspeed}ps | UL:{ulspeed}ps \n"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:
From 8b5032c6565901db859853f9e31248edf042e294 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 15:25:54 +0530
Subject: [PATCH 186/190] residue removal and fixes (#29)
* version bump
* python version change again.....
---
.github/workflows/release.yml | 2 +-
setup.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8a755c796..d15f5c735 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,7 +13,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
- python-version: 3.8.11
+ python-version: 3.8.12
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
diff --git a/setup.py b/setup.py
index 0280b05b6..047bad411 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.3',
+ version='6.0.4',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
From 2008d0a7532d3e69077b17f4a66eaed857cbcd2b Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Thu, 23 Sep 2021 19:49:22 +0530
Subject: [PATCH 187/190] Fix version mess
---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 047bad411..e13fb5cc9 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.4',
+ version='6.0.6',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
From ea187730cbfea39ee845aa0a40d5cf04e8614a27 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Wed, 6 Oct 2021 15:54:57 +0530
Subject: [PATCH 188/190] SA randomisation
---
bot/helper/mirror_utils/upload_utils/gdriveTools.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 149a56a17..d7a0018c3 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -8,6 +8,7 @@
import json
import requests
import logging
+from random import randrange
from google.auth.transport.requests import Request
from google.oauth2 import service_account
@@ -28,7 +29,8 @@
LOGGER = logging.getLogger(__name__)
logging.getLogger('googleapiclient.discovery').setLevel(logging.ERROR)
-SERVICE_ACCOUNT_INDEX = 0
+if USE_SERVICE_ACCOUNTS:
+ SERVICE_ACCOUNT_INDEX = randrange(len(os.listdir("accounts")))
TELEGRAPHLIMIT = 95
From 01494b7c675e869a81a0be7238d6acd6e5063961 Mon Sep 17 00:00:00 2001
From: Sunil Kumar <66400864+iamLiquidX@users.noreply.github.com>
Date: Wed, 13 Oct 2021 07:10:21 +0530
Subject: [PATCH 189/190] Small fix (#30)
* Fix to ffi.h not found
* Version bump
Fix LXML Build Issues and FFMpeg DNS issues
Zlib not found
Forgot to update version :alien:
Downgrade Python Version to 3.9
Never knew that python 3.10 got released
:angry:
Revert back to old version
Update setup.py
---
.github/workflows/release.yml | 2 +-
Dockerfile | 8 ++++----
setup.py | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d15f5c735..cd1694374 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,7 +27,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
- twine upload dist/*
+ twine upload dist/* || exit 0
- name: Upload all the data files to github Release
uses: softprops/action-gh-release@v1
with:
diff --git a/Dockerfile b/Dockerfile
index d3aa455b7..f14f71b59 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:slim
+FROM python:3.9-slim
WORKDIR /
# Deps
@@ -9,12 +9,12 @@ RUN if [ "$(uname -m)" = "aarch64" ] ; then \
fi && \
sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
apt-get -qq update && \
- apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev gcc && \
+ apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev gcc libffi-dev nscd && \
apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
- wget -q https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
+ wget -q https://github.com/yzop/gg/raw/main/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
mv ff*/ff* /usr/local/bin/ && rm -rf ff* && \
- wget -q https://github.com/viswanathbalusu/megasdkrest/releases/download/v0.1.1/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
+ wget -q https://github.com/viswanathbalusu/megasdkrest/releases/latest/download/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/ && \
pip3 install --no-cache-dir MirrorX && \
apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
diff --git a/setup.py b/setup.py
index e13fb5cc9..41cc779ac 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
setup(
name='MirrorX',
- version='6.0.6',
+ version='6.0.13',
packages=find_packages(),
long_description=README,
long_description_content_type="text/markdown",
From 3a410904bf7f1bf0c48b1f10cb47b5b3b8589225 Mon Sep 17 00:00:00 2001
From: OMEGA
Date: Fri, 19 May 2023 12:15:19 +0530
Subject: [PATCH 190/190] Refactored arch detection (#33)
* Updated arch detection
Arch detection with regex without loop
* Refactored arch detection
Useing regex for arch detection without loops
---
Dockerfile | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index f14f71b59..bd340f79c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,24 +2,29 @@ FROM python:3.9-slim
WORKDIR /
# Deps
-RUN if [ "$(uname -m)" = "aarch64" ] ; then \
- export HOST_CPU_ARCH=arm64; \
- elif [ "$(uname -m)" = "x86_64" ]; then \
- export HOST_CPU_ARCH=amd64; \
- fi && \
- sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
- apt-get -qq update && \
- apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev gcc libffi-dev nscd && \
- apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
- wget -q https://github.com/yzop/gg/raw/main/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
- tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
- mv ff*/ff* /usr/local/bin/ && rm -rf ff* && \
- wget -q https://github.com/viswanathbalusu/megasdkrest/releases/latest/download/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
- chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/ && \
- pip3 install --no-cache-dir MirrorX && \
- apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
+
+SHELL [ "/usr/bin/bash" , "-cel" ]
+
+RUN \
+[[ ${valid_arch:-aarch64 amd64 x86_64} =~ ${HOST_CPU_ARCH:=$(uname -m)} ]] \
+ || echo 'unsupported cpu arch' && exit 1
+
+RUN \
+export HOST_CPU_ARCH=$(uname -m) \
+sed -i 's/main/main non-free/g' /etc/apt/sources.list && \
+apt-get -qq update && \
+apt-get -qq install -y tzdata curl aria2 p7zip-full p7zip-rar wget xz-utils libmagic-dev gcc libffi-dev nscd && \
+apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean && \
+wget -q https://github.com/yzop/gg/raw/main/ffmpeg-git-${HOST_CPU_ARCH}-static.tar.xz && \
+tar -xf ff*.tar.xz && rm -rf *.tar.xz && \
+mv ff*/ff* /usr/local/bin/ && rm -rf ff* && \
+wget -q https://github.com/viswanathbalusu/megasdkrest/releases/latest/download/megasdkrest-${HOST_CPU_ARCH} -O /usr/local/bin/megasdkrest && \
+chmod a+x /usr/local/bin/megasdkrest && mkdir /app/ && chmod 777 /app/ && \
+pip3 install --no-cache-dir MirrorX && \
+apt-get purge -yqq gcc && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
WORKDIR /app
CMD ["MirrorX"]
+###