This commit is contained in:
yasir 2023-02-15 14:41:08 +07:00
parent c3902d0c9f
commit 222c4889ea

View file

@ -24,14 +24,8 @@ async def ddl_mediainfo(_, message, url):
""" """
try: try:
filename = re.search(".+/(.+)", url).group(1)
reply_msg = await kirimPesan(message, "Generating Mediainfo, Please wait..", quote=True) reply_msg = await kirimPesan(message, "Generating Mediainfo, Please wait..", quote=True)
output_ = await runcmd(f'mediainfo "{url}"')
with requests.get(url, stream=True) as r:
with open(filename, 'wb') as f:
for chunk in r.iter_content(50000000): f.write(chunk); break
output_ = await runcmd(f'mediainfo "{filename}"')
out = output_[0] if len(output_) != 0 else None out = output_[0] if len(output_) != 0 else None
content = f""" content = f"""
MissKatyBot MediaInfo MissKatyBot MediaInfo
@ -41,8 +35,7 @@ DETAILS
""" """
output = await post_to_telegraph(False, "MissKaty MediaInfo", content) output = await post_to_telegraph(False, "MissKaty MediaInfo", content)
await editPesan(reply_msg, f"**File Name :** `{unquote(filename)}`\n\n**Mediainfo :** {output}", disable_web_page_preview=True) await editPesan(reply_msg, f"**Link :** `{url}`\n\n**Mediainfo :** {output}", disable_web_page_preview=True)
os.remove(filename)
except Exception as err: except Exception as err:
await hapusPesan(reply_msg) await hapusPesan(reply_msg)