From 66a57bc0ee931296a567f5ac49cf17b7e0e90347 Mon Sep 17 00:00:00 2001 From: Juned KH Date: Thu, 25 Jul 2024 13:24:19 +0530 Subject: [PATCH] support password mediafire folder this will works only if every file has same password. --- .../download_utils/direct_link_generator.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py b/bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py index 436ccba5..e4fc1720 100644 --- a/bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py +++ b/bot/helper/mirror_leech_utils/download_utils/direct_link_generator.py @@ -1048,6 +1048,11 @@ def gofile(url): def mediafireFolder(url): + if "::" in url: + _password = url.split("::")[-1] + url = url.split("::")[-2] + else: + _password = "" try: raw = url.split("/", 4)[-1] folderkey = raw.split("/", 1)[0] @@ -1109,6 +1114,17 @@ def mediafireFolder(url): html = HTML(session.get(url).text) except: return + if html.xpath("//div[@class='passwordPrompt']"): + if not _password: + raise DirectDownloadLinkException( + f"ERROR: {PASSWORD_ERROR_MESSAGE}".format(url) + ) + try: + html = HTML(session.post(url, data={"downloadp": _password}).text) + except: + return + if html.xpath("//div[@class='passwordPrompt']"): + return if final_link := html.xpath("//a[@id='downloadButton']/@href"): return final_link[0]