diff --git a/misskaty/helper/mediainfo_paste.py b/misskaty/helper/mediainfo_paste.py
new file mode 100644
index 00000000..30bcae8a
--- /dev/null
+++ b/misskaty/helper/mediainfo_paste.py
@@ -0,0 +1,227 @@
+css = """
+
+
+"""
+
+from .http import http
+import json
+import re
+
+
+def html_builder(title: str, text: str) -> str:
+ """
+ Make proper html with css from given content.
+ """
+
+ heading = "{content}"
+ subheading = "{content}"
+ infobox = ""
+ subtitlebox = ""
+ icon = "
"
+ html_msg = "" + heading.format(content=title)
+
+ for line in text.splitlines():
+ if ":" not in line and bool(line):
+ if "Text #" in line:
+ if bool(re.search("Text #1$", line)):
+ subtitle_count = len(re.findall("Text #", text))
+ html_msg += icon.format(
+ icon_url="https://te.legra.ph/file/9d4a676445544d0f2d6db.png"
+ )
+ html_msg += subheading.format(
+ content=f"Subtitles ({subtitle_count} subtitle)"
+ )
+ html_msg += ""
+
+ elif "General" in line:
+ html_msg += icon.format(
+ icon_url="https://te.legra.ph/file/638fb0416f2600e7c5aa3.png"
+ )
+ html_msg += subheading.format(content="General")
+
+ elif "Video" in line:
+ html_msg += icon.format(
+ icon_url="https://te.legra.ph/file/fbc30d71cf71c9a54e59d.png"
+ )
+ html_msg += subheading.format(content="Video")
+
+ elif "Audio" in line:
+ html_msg += icon.format(
+ icon_url="https://te.legra.ph/file/a3c431be457fedbae2286.png"
+ )
+ html_msg += subheading.format(content=f"{line.strip()}")
+
+ elif "Menu" in line:
+ html_msg += ""
+ html_msg += icon.format(
+ icon_url="https://te.legra.ph/file/3023b0c2bc202ec9d6d0d.png"
+ )
+ html_msg += subheading.format(content="Chapters")
+
+ else:
+ html_msg += subheading.format(content=f"{line.strip()}")
+ html_msg += subtitlebox if "Text #" in line else infobox
+
+ elif ":" in line:
+ if "Attachments" in line:
+ pass
+ elif "ErrorDetectionType" in line:
+ pass
+ else:
+ html_msg += f"{line.strip()}
"
+
+ elif not bool(line):
+ html_msg += ""
+
+ html_msg += ""
+ return css + html_msg
+
+
+async def mediainfo_paste(text: str, title: str) -> str:
+ html_content = html_builder(title, text)
+ URL = "https://mediainfo-1-y5870653.deta.app/api"
+ response = await http.post(URL, json={"content": html_content})
+ return f"https://mediainfo-1-y5870653.deta.app/{json.loads(response.content)['key']}"
\ No newline at end of file
diff --git a/misskaty/plugins/mediainfo.py b/misskaty/plugins/mediainfo.py
index e41e3daa..8167ee2f 100644
--- a/misskaty/plugins/mediainfo.py
+++ b/misskaty/plugins/mediainfo.py
@@ -17,6 +17,7 @@ from misskaty import app
from misskaty.core.message_utils import *
from misskaty.core.decorator.ratelimiter import ratelimiter
from misskaty.helper import http, progress_for_pyrogram, runcmd, post_to_telegraph
+from misskaty.helper.mediainfo_paste import mediainfo_paste
from misskaty.vars import COMMAND_HANDLER
from utils import get_file_id
@@ -51,15 +52,7 @@ DETAILS
"""
text_ = file_info.message_type
try:
- json_data = {
- "content": body_text,
- "highlighting_language": "auto",
- "ephemeral": False,
- "expire_at": 0,
- "expire_in": 0,
- }
- response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
- link = f"https://paste.yasir.eu.org/{response.json()['id']}"
+ link = await mediainfo_paste(out, "MissKaty Mediainfo")
markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="💬 View in Web", url=link)]])
except:
try:
@@ -93,15 +86,7 @@ DETAILS
"""
# link = await post_to_telegraph(False, title, body_text)
try:
- json_data = {
- "content": body_text,
- "highlighting_language": "auto",
- "ephemeral": False,
- "expire_at": 0,
- "expire_in": 0,
- }
- response = await http.post("https://paste.yasir.eu.org/api/new", json=json_data)
- link = f"https://paste.yasir.eu.org/{response.json()['id']}"
+ link = await mediainfo_paste(out, "MissKaty Mediainfo")
markup = InlineKeyboardMarkup([[InlineKeyboardButton(text="💬 View in Web", url=link)]])
except:
try: