From bf4d1b7195835d98fac2348a550193494566feae Mon Sep 17 00:00:00 2001
From: yasirarism <55983182+yasirarism@users.noreply.github.com>
Date: Fri, 23 Jun 2023 07:18:06 +0000
Subject: [PATCH] Minor FIx (#97)
---
Dockerfile | 9 +++++++--
misskaty/plugins/imdb_search.py | 20 ++++++++++----------
misskaty/plugins/ytdl_plugins.py | 11 ++++++-----
3 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index e2c9b220..51652036 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,11 +4,16 @@
# * Copyright ©YasirPedia All rights reserved
# Base Docker Using Ubuntu 23.04, Python 3.11 and Built In Pip
-FROM yasirarism/misskaty-docker:latest
+## With Built in Pip Package
+# FROM yasirarism/misskaty-docker:latest
+## Without Built in Pip Package
+FROM yasirarism/misskaty-docker:free
# Set Hostname
ENV HOSTNAME misskaty
# Copy Files
COPY . .
+# Instal pip package
+RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
# Set CMD Bot
-CMD ["bash", "start.sh"]
\ No newline at end of file
+CMD ["bash", "start.sh"]
diff --git a/misskaty/plugins/imdb_search.py b/misskaty/plugins/imdb_search.py
index bfb67f07..66ba2dee 100644
--- a/misskaty/plugins/imdb_search.py
+++ b/misskaty/plugins/imdb_search.py
@@ -367,15 +367,15 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
return await query.answer("⚠️ Akses Ditolak!", True)
try:
await query.message.edit_caption("⏳ Permintaan kamu sedang diproses.. ")
- url = f"https://www.imdb.com/title/tt{movie}/"
- resp = await http.get(url, headers=headers)
+ imdb_url = f"https://www.imdb.com/title/tt{movie}/"
+ resp = await http.get(imdb_url, headers=headers)
sop = BeautifulSoup(resp, "lxml")
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
ott = await search_jw(r_json.get("name"), "ID")
typee = r_json.get("@type", "")
res_str = ""
tahun = re.findall(r"\d{4}\W\d{4}|\d{4}-?", sop.title.text)[0] if re.findall(r"\d{4}\W\d{4}|\d{4}-?", sop.title.text) else "N/A"
- res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n"
+ res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n"
if aka := r_json.get("alternateName"):
res_str += f"📢 AKA: {aka}\n\n"
else:
@@ -453,13 +453,13 @@ async def imdb_id_callback(self: Client, query: CallbackQuery):
markup = InlineKeyboardMarkup(
[
[
- InlineKeyboardButton("🎬 Open IMDB", url=url),
+ InlineKeyboardButton("🎬 Open IMDB", url=imdb_url),
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
]
]
)
else:
- markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Open IMDB", url=url)]])
+ markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Open IMDB", url=imdb_url)]])
if thumb := r_json.get("image"):
try:
await query.message.edit_media(
@@ -491,15 +491,15 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
return await query.answer("⚠️ Access Denied!", True)
try:
await query.message.edit_caption("⏳ Getting IMDb source..")
- url = f"https://www.imdb.com/title/tt{movie}/"
- resp = await http.get(url, headers=headers)
+ imdb_url = f"https://www.imdb.com/title/tt{movie}/"
+ resp = await http.get(imdb_url, headers=headers)
sop = BeautifulSoup(resp, "lxml")
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
ott = await search_jw(r_json.get("name"), "US")
typee = r_json.get("@type", "")
res_str = ""
tahun = re.findall(r"\d{4}\W\d{4}|\d{4}-?", sop.title.text)[0] if re.findall(r"\d{4}\W\d{4}|\d{4}-?", sop.title.text) else "N/A"
- res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n"
+ res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n"
if aka := r_json.get("alternateName"):
res_str += f"📢 AKA: {aka}\n\n"
else:
@@ -576,13 +576,13 @@ async def imdb_en_callback(self: Client, query: CallbackQuery):
markup = InlineKeyboardMarkup(
[
[
- InlineKeyboardButton("🎬 Open IMDB", url=url),
+ InlineKeyboardButton("🎬 Open IMDB", url=imdb_url),
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
]
]
)
else:
- markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Open IMDB", url=url)]])
+ markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Open IMDB", url=imdb_url)]])
if thumb := r_json.get("image"):
try:
await query.message.edit_media(
diff --git a/misskaty/plugins/ytdl_plugins.py b/misskaty/plugins/ytdl_plugins.py
index 4c7fc0f2..7cb8678b 100644
--- a/misskaty/plugins/ytdl_plugins.py
+++ b/misskaty/plugins/ytdl_plugins.py
@@ -217,11 +217,12 @@ async def ytdl_cancel_callback(self: Client, cq: CallbackQuery, strings):
callback = cq.data.split("|")
await cq.answer("Trying to Cancel Process..")
process_id = callback[1]
- Process.cancel_id(process_id)
- if cq.message:
- await cq.message.delete()
- else:
- await cq.edit_message_text("✔️ `Stopped Successfully`")
+ try:
+ Process.cancel_id(process_id)
+ except:
+ pass
+ await cq.message.delete()
+ await cq.edit_message_text("✔️ `Stopped Successfully`")
@app.on_callback_query(filters.regex(r"^ytdl_scroll"))