Skip to content

Commit

Permalink
easyupload io support
Browse files Browse the repository at this point in the history
taken #1560
  • Loading branch information
junedkh committed Sep 7, 2023
1 parent 4a71061 commit 48998d9
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ In each single file there is a major change from base code, it's almost totaly d
- Extract these filetypes
> 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, TAR.XZ
- Direct links Supported:
> mediafire, letsupload.io, hxfile.co, antfiles, fembed.com, fembed.net, femax20.com, layarkacaxxi.icu, fcdn.stream, sbplay.org, naniplay.com, naniplay.nanime.in, naniplay.nanime.biz, sbembed.com, streamtape.com, streamsb.net, feurl.com, upload.ee, pixeldrain.com, racaty.net, 1fichier.com, 1drv.ms (Only works for file not folder or business account), uptobox.com and solidfiles.com, linkbox.to, shrdsk.me (sharedisk.io), akmfiles.com, wetransfer.com, gofile.io, mdisk.me (with ytdl), terabox.com (you need to add cookies txt with name) [terabox.txt](https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl) and almost every anonfiles based sites
> mediafire (file/folders), letsupload.io, hxfile.co, antfiles, fembed.com, fembed.net, femax20.com, layarkacaxxi.icu, fcdn.stream, sbplay.org, naniplay.com, naniplay.nanime.in, naniplay.nanime.biz, sbembed.com, streamtape.com, streamsb.net, feurl.com, upload.ee, pixeldrain.com, racaty.net, 1fichier.com, 1drv.ms (Only works for file not folder or business account), uptobox.com, send.cm (file/folders), solidfiles.com, linkbox.to, shrdsk.me (sharedisk.io), akmfiles.com, wetransfer.com, gofile.io (file/folders), easyupload.io, mdisk.me (with ytdl), terabox.com (file/folders) (you need to add cookies txt with name) [terabox.txt](https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl) and almost every anonfiles based sites
# How to deploy?

Expand Down
10 changes: 10 additions & 0 deletions bot/helper/ext_utils/help_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,13 @@
Note: If -up not specified then rclone destination will be the RCLONE_PATH from config.env
"""

PASSWORD_ERROR_MESSAGE = """
<b>This link requires a password!</b>
- Insert sign <b>::</b> after the link and write the password after the sign.
<b>Example:</b> {}::love you
Note: No spaces between the signs <b>::</b>
For the password, you can use a space!
"""
70 changes: 65 additions & 5 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from bot.helper.ext_utils.bot_utils import (get_readable_time, is_share_link,
text_size_to_bytes)
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
from bot.helper.ext_utils.help_messages import PASSWORD_ERROR_MESSAGE

_caches = {}

Expand All @@ -40,7 +41,6 @@
'filechan.org', 'myfile.is', 'vshare.is', 'rapidshare.nu', 'lolabits.se',
'openload.cc', 'share-online.is', 'upvid.cc']


def direct_link_generator(link: str):
""" direct links generator """
domain = urlparse(link).hostname
Expand Down Expand Up @@ -89,6 +89,8 @@ def direct_link_generator(link: str):
return gofile(link)
elif 'send.cm' in domain:
return send_cm(link)
elif 'easyupload.io' in domain:
return easyupload(link)
elif any(x in domain for x in ['dood.watch', 'doodstream.com', 'dood.to', 'dood.so', 'dood.cx', 'dood.la', 'dood.ws', 'dood.sh', 'doodstream.co', 'dood.pm', 'dood.wf', 'dood.re', 'dood.video', 'dooood.com', 'dood.yt', 'dood.stream', 'doods.pro']):
return doods(link)
elif any(x in domain for x in ['streamtape.com', 'streamtape.co', 'streamtape.cc', 'streamtape.to', 'streamtape.net', 'streamta.pe', 'streamtape.xyz']):
Expand Down Expand Up @@ -116,6 +118,17 @@ def direct_link_generator(link: str):
raise DirectDownloadLinkException(
f'No Direct link function found for {link}')

def get_captcha_token(session, params):
recaptcha_api = 'https://www.google.com/recaptcha/api2'
res = session.get(f'{recaptcha_api}/anchor', params=params)
anchor_html = HTML(res.text)
if not (anchor_token:= anchor_html.xpath('//input[@id="recaptcha-token"]/@value')):
return
params['c'] = anchor_token[0]
params['reason'] = 'q'
res = session.post(f'{recaptcha_api}/reload', params=params)
if token := findall(r'"rresp","(.*?)"', res.text):
return token[0]

def yandex_disk(url: str) -> str:
""" Yandex.Disk direct link generator
Expand Down Expand Up @@ -426,7 +439,7 @@ def fichier(link):
"ERROR: 1fichier is on a limit. Please wait a few minutes/hour.")
elif "protect access" in str(str_2).lower():
raise DirectDownloadLinkException(
"ERROR: This link requires a password!\n\n<b>This link requires a password!</b>\n- Insert sign <b>::</b> after the link and write the password after the sign.\n\n<b>Example:</b> https://1fichier.com/?smmtd8twfpm66awbqz04::love you\n\n* No spaces between the signs <b>::</b>\n* For the password, you can use a space!")
f"ERROR:\n{PASSWORD_ERROR_MESSAGE.format(link)}")
else:
raise DirectDownloadLinkException(
"ERROR: Failed to generate Direct Link from 1fichier!")
Expand Down Expand Up @@ -835,7 +848,7 @@ def __fetch_links(_id, folderPath=''):
except Exception as e:
raise DirectDownloadLinkException(f"ERROR: {e.__class__.__name__}")
if _json['status'] in 'error-passwordRequired':
raise DirectDownloadLinkException(f'ERROR: This link requires a password!\n\n<b>This link requires a password!</b>\n- Insert sign <b>::</b> after the link and write the password after the sign.\n\n<b>Example:</b> {url}::love you\n\n* No spaces between the signs <b>::</b>\n* For the password, you can use a space!')
raise DirectDownloadLinkException(f"ERROR:\n{PASSWORD_ERROR_MESSAGE.format(url)}")
if _json['status'] in 'error-passwordWrong':
raise DirectDownloadLinkException('ERROR: This password is wrong !')
if _json['status'] in 'error-notFound':
Expand Down Expand Up @@ -1043,7 +1056,7 @@ def send_cm_file(url, file_id=None):
except Exception as e:
raise DirectDownloadLinkException(f'ERROR: {e.__class__.__name__}')
if _passwordNeed:
raise DirectDownloadLinkException(f'ERROR: This link requires or wrong password!\n\n<b>This link requires a password!</b>\n- Insert sign <b>::</b> after the link and write the password after the sign.\n\n<b>Example:</b> {url}::love you\n\n* No spaces between the signs <b>::</b>\n* For the password, you can use a space!')
raise DirectDownloadLinkException(f"ERROR:\n{PASSWORD_ERROR_MESSAGE.format(url)}")
raise DirectDownloadLinkException("ERROR: Direct link not found")

def send_cm(url: str):
Expand Down Expand Up @@ -1152,4 +1165,51 @@ def doods(url):
f'ERROR: {e.__class__.__name__} While fetching download link')
if not (link := search(r"window\.open\('(\S+)'", _res.text)):
raise DirectDownloadLinkException("ERROR: Download link not found try again")
return (link.group(1), f'Referer: {parsed_url.scheme}://{parsed_url.hostname}/')
return (link.group(1), f'Referer: {parsed_url.scheme}://{parsed_url.hostname}/')

def easyupload(url):
if "::" in url:
_password = url.split("::")[-1]
url = url.split("::")[-2]
else:
_password = ''
file_id = url.split("/")[-1]
with create_scraper() as session:
try:
_res = session.get(url)
except Exception as e:
raise DirectDownloadLinkException(f'ERROR: {e.__class__.__name__}')
first_page_html = HTML(_res.text)
if first_page_html.xpath("//h6[contains(text(),'Password Protected')]") and not _password:
raise DirectDownloadLinkException(f"ERROR:\n{PASSWORD_ERROR_MESSAGE.format(url)}")
if not (match := search(r'https://eu(?:[1-9][0-9]?|100)\.easyupload\.io/action\.php', _res.text)):
raise DirectDownloadLinkException("ERROR: Failed to get server for EasyUpload Link")
action_url = match.group()
session.headers.update({'referer': 'https://easyupload.io/'})
recaptcha_params = {
'k': '6LfWajMdAAAAAGLXz_nxz2tHnuqa-abQqC97DIZ3',
'ar': '1',
'co': 'aHR0cHM6Ly9lYXN5dXBsb2FkLmlvOjQ0Mw..',
'hl': 'en',
'v': '0hCdE87LyjzAkFO5Ff-v7Hj1',
'size': 'invisible',
'cb': 'c3o1vbaxbmwe'
}
if not (captcha_token :=get_captcha_token(session, recaptcha_params)):
raise DirectDownloadLinkException('ERROR: Captcha token not found')
try:
data = {'type': 'download-token',
'url': file_id,
'value': _password,
'captchatoken': captcha_token,
'method': 'regular'}
json_resp = session.post(url=action_url, data=data).json()
except Exception as e:
raise DirectDownloadLinkException(f'ERROR: {e.__class__.__name__}')
if 'download_link' in json_resp:
return json_resp['download_link']
elif 'data' in json_resp:
raise DirectDownloadLinkException(
f"ERROR: Failed to generate direct link due to {json_resp['data']}")
raise DirectDownloadLinkException(
"ERROR: Failed to generate direct link from EasyUpload.")
8 changes: 5 additions & 3 deletions bot/modules/mirror_leech.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ async def __run_multi():
if isinstance(link, str):
LOGGER.info(f"Generated link: {link}")
except DirectDownloadLinkException as e:
LOGGER.info(str(e))
if str(e).startswith('ERROR:'):
await sendMessage(message, str(e))
e = str(e)
if 'This link requires a password!' not in e:
LOGGER.info(e)
if e.startswith('ERROR:'):
await sendMessage(message, e)
return

user_id = message.from_user.id
Expand Down

0 comments on commit 48998d9

Please sign in to comment.