diff --git a/.gitignore b/.gitignore index b66590ecc13c..7904d7e07a06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +zee_env/* config.env *.pyc data* diff --git a/Dockerfile b/Dockerfile index f0035bb989a9..85d280c2de3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /usr/src/app RUN chmod 777 /usr/src/app COPY requirements.txt . -RUN pip3 install --break-system-packages --no-cache-dir -r requirements.txt +RUN zee_env/bin/pip3.12 install --no-cache-dir -r requirements.txt COPY . . diff --git a/bot/helper/ext_utils/help_messages.py b/bot/helper/ext_utils/help_messages.py index f747c9750030..df1bd45d50fb 100644 --- a/bot/helper/ext_utils/help_messages.py +++ b/bot/helper/ext_utils/help_messages.py @@ -270,7 +270,7 @@ name_sub = r""" Name Substitution: -ns -b>Name Substitution: -ns +Name Substitution: -ns /cmd link -ns script/code/s | mirror/leech | tea/ /s | clone | cpu/ | \[ZEE\]/ZEE | \\text\\/text/s This will affect on all files. Format: wordToReplace/wordToReplaceWith/sensitiveCase Word Subtitions. You can add pattern instead of normal text. Timeout: 60 sec diff --git a/bot/helper/task_utils/download_utils/direct_link_generator.py b/bot/helper/task_utils/download_utils/direct_link_generator.py index 760bb038c88d..a7ff790cbe74 100644 --- a/bot/helper/task_utils/download_utils/direct_link_generator.py +++ b/bot/helper/task_utils/download_utils/direct_link_generator.py @@ -31,7 +31,6 @@ from ...ext_utils.links_utils import is_share_link from ...ext_utils.status_utils import speed_string_to_bytes - user_agent = ( "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0" ) @@ -42,7 +41,7 @@ def direct_link_generator(link): domain = urlparse(link).hostname if not domain: raise DirectDownloadLinkException("ERROR: Invalid URL") - if "yadi.sk" in link or "disk.yandex." in link: + elif "yadi.sk" in link or "disk.yandex." in link: return yandex_disk(link) elif "mediafire.com" in domain: return mediafire(link) @@ -54,7 +53,14 @@ def direct_link_generator(link): return hxfile(link) elif "1drv.ms" in domain: return onedrive(link) - elif "pixeldrain.com" in domain: + elif any( + x in domain + for x + in [ + "pixeldrain.com", + "pixeldra.in" + ] + ): return pixeldrain(link) elif "racaty" in domain: return racaty(link) @@ -448,11 +454,11 @@ def pixeldrain(url): url = url.strip("/ ") file_id = url.split("/")[-1] if url.split("/")[-2] == "l": - info_link = f"https://pixeldrain.com/api/list/{file_id}" - dl_link = f"https://pixeldrain.com/api/list/{file_id}/zip?download" + info_link = f"https://pixeldra.in/api/list/{file_id}" + dl_link = f"https://pixeldra.in/api/list/{file_id}/zip?download" else: - info_link = f"https://pixeldrain.com/api/file/{file_id}/info" - dl_link = f"https://pixeldrain.com/api/file/{file_id}?download" + info_link = f"https://pixeldra.in/api/file/{file_id}/info" + dl_link = f"https://pixeldra.in/api/file/{file_id}?download" with create_scraper() as session: try: resp = session.get(info_link).json() @@ -462,10 +468,11 @@ def pixeldrain(url): return dl_link else: raise DirectDownloadLinkException( - f"ERROR: Cant't download due {resp['message']}." + f"ERROR: Can't download due to {resp['message']}." ) + def streamtape(url): splitted_url = url.split("/") _id = ( @@ -1107,11 +1114,11 @@ def __get_token(session): "Accept": "*/*", "Connection": "keep-alive", } - __url = f"https://api.gofile.io/accounts" + __url = "https://api.gofile.io/accounts" try: __res = session.post(__url, headers=headers).json() if __res["status"] != "ok": - raise DirectDownloadLinkException(f"ERROR: Failed to get token.") + raise DirectDownloadLinkException("ERROR: Failed to get token.") return __res["data"]["token"] except Exception as e: raise e diff --git a/bot/helper/task_utils/download_utils/yt_dlp_download.py b/bot/helper/task_utils/download_utils/yt_dlp_download.py index ad945e729c35..73e29bb14e9f 100644 --- a/bot/helper/task_utils/download_utils/yt_dlp_download.py +++ b/bot/helper/task_utils/download_utils/yt_dlp_download.py @@ -74,7 +74,6 @@ def __init__(self, listener): self._eta = "-" self._listener = listener self._gid = "" - self._downloading = False self._ext = "" self.is_playlist = False self.playlist_index = 0 @@ -123,7 +122,6 @@ def eta(self): return self._eta def _on_download_progress(self, d): - self._downloading = True if self._listener.is_cancelled: raise ValueError("Cancelling...") if d["status"] == "finished": @@ -438,8 +436,7 @@ async def add_download(self, path, qual, playlist, options): async def cancel_task(self): self._listener.is_cancelled = True LOGGER.info(f"Cancelling Download: {self._listener.name}") - if not self._downloading: - await self._listener.on_download_error("Download Cancelled by User!") + await self._listener.on_download_error("Download Cancelled by User!") def _set_options(self, options): options = options.split("|") @@ -487,7 +484,10 @@ def _set_options(self, options): list ): self.opts[key].extend(tuple(value)) - elif isinstance(value, dict): + elif isinstance( + value, + dict + ): self.opts[key].append(value) elif key == "download_ranges": if isinstance(value, list): diff --git a/bot/helper/task_utils/telegram_uploader.py b/bot/helper/task_utils/telegram_uploader.py index ed806784a9b1..334841906714 100644 --- a/bot/helper/task_utils/telegram_uploader.py +++ b/bot/helper/task_utils/telegram_uploader.py @@ -430,7 +430,7 @@ async def _send_media_group(self, subkey, key, msgs): msgs_list ) dm_msgs_list = await self._sent_DMmsg.reply_media_group( - media=grouped_media, + media=grouped_media, # type: ignore quote=True ) self._sent_DMmsg = dm_msgs_list[-1] @@ -572,20 +572,18 @@ async def upload(self, o_files, ft_delete): self._corrupted += 1 if self._listener.is_cancelled: return - continue - finally: - if ( - not self._listener.is_cancelled - and await aiopath.exists(self._up_path) - and ( - not self._listener.seed - or self._listener.new_dir - or dirpath.endswith("/splited_files_zee") - or "/copied_zee/" in self._up_path - or delete_file - ) - ): - await remove(self._up_path) + if ( + not self._listener.is_cancelled + and await aiopath.exists(self._up_path) + and ( + not self._listener.seed + or self._listener.new_dir + or dirpath.endswith("/splited_files_zee") + or "/copied_zee/" in self._up_path + or delete_file + ) + ): + await remove(self._up_path) for ( key, value @@ -884,7 +882,7 @@ async def _upload_file(self, cap_mono, file, o_path, force_document=False): LOGGER.error(f"{err_type}{err}. Path: {self._up_path}") if ( "Telegram says: [400" in str(err) - and key != "documents" + and key != "documents" # type: ignore ): LOGGER.error(f"Retrying As Document. Path: {self._up_path}") return await self._upload_file( diff --git a/requirements.txt b/requirements.txt index be03e6627c09..91ae0eb35fc3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ aria2p asyncio bencoding cloudscraper +cryptography dnspython feedparser flask diff --git a/start.sh b/start.sh index 9b2bf653cbe2..d4132ebb222f 100644 --- a/start.sh +++ b/start.sh @@ -1 +1,3 @@ -python3 update.py && python3 -m bot +source zee_env/bin/activate +python3 update.py +python3 -m bot \ No newline at end of file