File tree 1 file changed +17
-0
lines changed
bot/helper/mirror_leech_utils/download_utils
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,11 @@ def get_captcha_token(session, params):
218
218
def mediafire (url , session = None ):
219
219
if "/folder/" in url :
220
220
return mediafireFolder (url )
221
+ if "::" in url :
222
+ _password = url .split ("::" )[- 1 ]
223
+ url = url .split ("::" )[- 2 ]
224
+ else :
225
+ _password = ""
221
226
if final_link := findall (
222
227
r"https?:\/\/download\d+\.mediafire\.com\/\S+\/\S+\/\S+" , url
223
228
):
@@ -234,6 +239,18 @@ def mediafire(url, session=None):
234
239
if error := html .xpath ('//p[@class="notranslate"]/text()' ):
235
240
session .close ()
236
241
raise DirectDownloadLinkException (f"ERROR: { error [0 ]} " )
242
+ if html .xpath ("//div[@class='passwordPrompt']" ):
243
+ if not _password :
244
+ session .close ()
245
+ raise DirectDownloadLinkException (f"ERROR: { PASSWORD_ERROR_MESSAGE } " .format (url ))
246
+ try :
247
+ html = HTML (session .post (url , data = {"downloadp" : _password }).text )
248
+ except Exception as e :
249
+ session .close ()
250
+ raise DirectDownloadLinkException (f"ERROR: { e .__class__ .__name__ } " ) from e
251
+ if html .xpath ("//div[@class='passwordPrompt']" ):
252
+ session .close ()
253
+ raise DirectDownloadLinkException ("ERROR: Wrong password." )
237
254
if not (final_link := html .xpath ("//a[@id='downloadButton']/@href" )):
238
255
session .close ()
239
256
raise DirectDownloadLinkException (
You can’t perform that action at this time.
0 commit comments