diff --git a/Dockerfile b/Dockerfile index d572e05e2a..c826a994af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,12 @@ RUN chmod 777 /usr/src/app COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt +RUN playwright install chromium +RUN playwright install-deps RUN apt-get update && apt-get upgrade -y RUN apt -qq update --fix-missing && \ apt -qq install -y mediainfo COPY . . -CMD ["bash", "start.sh"] \ No newline at end of file +CMD ["bash", "start.sh"] diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index ae1acfcc5a..1ef584c953 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -403,6 +403,10 @@ def is_sharedrive_link(url: str): url = re_match(r'https?://(sharedrive)\.\S+', url) return bool(url) +def is_filepress_link(url: str): + url = re_match(r'https?://(filepress|filebee)\.\S+', url) + return bool(url) + def is_mega_link(url: str): return "mega.nz" in url or "mega.co.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 15254a6ca3..cf7a3c00c7 100644 --- a/bot/helper/mirror_utils/download_utils/direct_link_generator.py +++ b/bot/helper/mirror_utils/download_utils/direct_link_generator.py @@ -24,6 +24,7 @@ from base64 import standard_b64encode, b64decode from selenium import webdriver from selenium.webdriver.common.by import By +from playwright.sync_api import Playwright, sync_playwright, expect from bot import LOGGER, config_dict from bot.helper.telegram_helper.bot_commands import BotCommands @@ -92,6 +93,8 @@ def direct_link_generator(link: str): return sharer_pw_dl(link) elif is_sharedrive_link(link): return shareDrive(link) + elif is_filepress_link(link): + return filepress(link) elif any(x in link for x in fmed_list): return fembed(link) elif any(x in link for x in ['sbembed.com', 'watchsb.com', 'streamsb.net', 'sbplay.org']): @@ -807,3 +810,40 @@ def shareDrive(url,directLogin=True): return driveUrl else: raise DirectDownloadLinkException("ERROR! File Not Found or User rate exceeded !!") + +def prun(playwright: Playwright, link:str) -> str: + """ filepress google drive link generator + By https://t.me/maverick9099 + GitHub: https://github.com/majnurangeela""" + + browser = playwright.chromium.launch() + context = browser.new_context() + + page = context.new_page() + page.goto(link) + + firstbtn = page.locator("xpath=//div[text()='Direct Download']/parent::button") + expect(firstbtn).to_be_visible() + firstbtn.click() + sleep(10) + + secondBtn = page.get_by_role("button", name="Download Now") + expect(secondBtn).to_be_visible() + with page.expect_navigation(): + secondBtn.click() + + Flink = page.url + + context.close() + browser.close() + + if 'drive.google.com' in Flink: + return Flink + else: + raise DirectDownloadLinkException("Unable To Get Google Drive Link!") + + +def filepress(link:str) -> str: + with sync_playwright() as playwright: + flink = prun(playwright, link) + return flink diff --git a/bot/helper/mirror_utils/download_utils/gd_downloader.py b/bot/helper/mirror_utils/download_utils/gd_downloader.py index 458375b087..951443d4c1 100644 --- a/bot/helper/mirror_utils/download_utils/gd_downloader.py +++ b/bot/helper/mirror_utils/download_utils/gd_downloader.py @@ -8,7 +8,7 @@ from bot.helper.ext_utils.fs_utils import get_base_name, check_storage_threshold -def add_gd_download(link, path, listener, newname, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive): +def add_gd_download(link, path, listener, newname, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive, is_filepress): res, size, name, files = GoogleDriveHelper().helper(link) if res != "": return sendMessage(res, listener.bot, listener.message) diff --git a/bot/modules/clone.py b/bot/modules/clone.py index af02226bf4..6de2d3cf3f 100644 --- a/bot/modules/clone.py +++ b/bot/modules/clone.py @@ -141,7 +141,8 @@ def _clone(message, bot): is_udrive = is_udrive_link(link) is_sharer = is_sharer_link(link) is_sharedrive = is_sharedrive_link(link) - if (is_gdtot or is_unified or is_udrive or is_sharer or is_sharedrive): + is_filepress = is_filepress_link(link) + if (is_gdtot or is_unified or is_udrive or is_sharer or is_sharedrive or is_filepress): try: msg = sendMessage(f"Processing: {link}", bot, message) LOGGER.info(f"Processing: {link}") @@ -155,6 +156,8 @@ def _clone(message, bot): link = sharer_pw_dl(link) if is_sharedrive: link = shareDrive(link) + if is_filepress: + link = filepress(link) LOGGER.info(f"Processing GdToT: {link}") deleteMessage(bot, msg) except DirectDownloadLinkException as e: diff --git a/bot/modules/mirror_leech.py b/bot/modules/mirror_leech.py index a8dd589544..0eccf2e40f 100644 --- a/bot/modules/mirror_leech.py +++ b/bot/modules/mirror_leech.py @@ -97,6 +97,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec is_udrive = False is_sharer = False is_sharedrive = False + is_filepress = False index = 1 ratio = None seed_time = None @@ -227,6 +228,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec is_udrive = is_udrive_link(link) is_sharer = is_sharer_link(link) is_sharedrive = is_sharedrive_link(link) + is_filepress = is_filepress_link(link) link = direct_link_generator(link) LOGGER.info(f"Generated link: {link}") except DirectDownloadLinkException as e: @@ -268,7 +270,7 @@ def _mirror_leech(bot, message, isZip=False, extract=False, isQbit=False, isLeec gmsg += f"Use /{BotCommands.UnzipMirrorCommand} to extracts Google Drive archive file" sendMessage(gmsg, bot, message) else: - Thread(target=add_gd_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}', listener, name, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive)).start() + Thread(target=add_gd_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}', listener, name, is_gdtot, is_unified, is_udrive, is_sharer, is_sharedrive, is_filepress)).start() elif is_mega_link(link): Thread(target=add_mega_download, args=(link, f'{DOWNLOAD_DIR}{listener.uid}/', listener, name)).start() elif isQbit and (is_magnet(link) or ospath.exists(link)): diff --git a/requirements.txt b/requirements.txt index 2655c73736..58105d7ee1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,3 +40,4 @@ urllib3 xattr yt-dlp waybackpy +playwright