mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-07 12:24:51 +00:00
Add wetransfer
This commit is contained in:
parent
7e3b81bb76
commit
c5f77e9840
1 changed files with 44 additions and 1 deletions
|
|
@ -5,7 +5,8 @@
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
import re
|
import re, requests
|
||||||
|
import urllib.parse
|
||||||
from misskaty.helper.http import http
|
from misskaty.helper.http import http
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
|
|
@ -19,6 +20,7 @@ from misskaty.helper.human_read import get_readable_file_size
|
||||||
|
|
||||||
LIST_LINK = """
|
LIST_LINK = """
|
||||||
- Pling and all aliases.
|
- Pling and all aliases.
|
||||||
|
- Wetransfer
|
||||||
- Other link soon...
|
- Other link soon...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -28,6 +30,8 @@ __HELP__ = f"""
|
||||||
|
|
||||||
Supported Link:
|
Supported Link:
|
||||||
{LIST_LINK}
|
{LIST_LINK}
|
||||||
|
|
||||||
|
Credit: <a href='https://github.com/sanjit-sinha/PyBypass'>PyBypass</a>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,6 +51,42 @@ async def pling_bypass(url):
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
|
def wetransfer_bypass(url: str) -> str:
|
||||||
|
|
||||||
|
if url.startswith("https://we.tl/"):
|
||||||
|
r = requests.head(url, allow_redirects=True)
|
||||||
|
url = r.url
|
||||||
|
recipient_id = None
|
||||||
|
params = urllib.parse.urlparse(url).path.split("/")[2:]
|
||||||
|
|
||||||
|
if len(params) == 2:
|
||||||
|
transfer_id, security_hash = params
|
||||||
|
elif len(params) == 3:
|
||||||
|
transfer_id, recipient_id, security_hash = params
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
j = {
|
||||||
|
"intent": "entire_transfer",
|
||||||
|
"security_hash": security_hash,
|
||||||
|
}
|
||||||
|
|
||||||
|
if recipient_id:
|
||||||
|
j["recipient_id"] = recipient_id
|
||||||
|
|
||||||
|
s = requests.Session()
|
||||||
|
r = s.get("https://wetransfer.com/")
|
||||||
|
m = re.search('name="csrf-token" content="([^"]+)"', r.text)
|
||||||
|
s.headers.update({"x-csrf-token": m[1], "x-requested-with": "XMLHttpRequest"})
|
||||||
|
r = s.post(
|
||||||
|
f"https://wetransfer.com/api/v4/transfers/{transfer_id}/download", json=j
|
||||||
|
)
|
||||||
|
j = r.json()
|
||||||
|
dl_url = j["direct_link"]
|
||||||
|
|
||||||
|
return f"\n**Source Link** :\n`{url}`\n**Direct Link :**\n{dl_url}"
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["directurl"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["directurl"], COMMAND_HANDLER))
|
||||||
@capture_err
|
@capture_err
|
||||||
async def bypass(_, message):
|
async def bypass(_, message):
|
||||||
|
|
@ -55,6 +95,7 @@ async def bypass(_, message):
|
||||||
f"Gunakan perintah /{message.command[0]} untuk bypass url"
|
f"Gunakan perintah /{message.command[0]} untuk bypass url"
|
||||||
)
|
)
|
||||||
url = message.command[1]
|
url = message.command[1]
|
||||||
|
host = urllib.parse.urlparse(url).netloc
|
||||||
msg = await message.reply("Bypassing URL..", quote=True)
|
msg = await message.reply("Bypassing URL..", quote=True)
|
||||||
mention = f"**Bypasser:** {message.from_user.mention} ({message.from_user.id})"
|
mention = f"**Bypasser:** {message.from_user.mention} ({message.from_user.id})"
|
||||||
if re.match(r"https?://(store.kde.org|www.pling.com)\/p\/(\d+)", url):
|
if re.match(r"https?://(store.kde.org|www.pling.com)\/p\/(\d+)", url):
|
||||||
|
|
@ -76,5 +117,7 @@ async def bypass(_, message):
|
||||||
reply_markup=markup,
|
reply_markup=markup,
|
||||||
disable_web_page_preview=True,
|
disable_web_page_preview=True,
|
||||||
)
|
)
|
||||||
|
elif "we.tl" or "wetransfer.com" in host:
|
||||||
|
await msg.edit(f"{data}\n\n{mention}")
|
||||||
else:
|
else:
|
||||||
await msg.edit("Unsupported link..")
|
await msg.edit("Unsupported link..")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue