mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-08 12:54:51 +00:00
Fixes
This commit is contained in:
parent
b6ecebc232
commit
40803fcbe4
2 changed files with 168 additions and 92 deletions
|
|
@ -1,27 +1,25 @@
|
||||||
import json
|
import json
|
||||||
import re
|
|
||||||
import logging
|
import logging
|
||||||
from utils import demoji
|
import re
|
||||||
from pykeyboard import InlineKeyboard, InlineButton
|
import traceback
|
||||||
from pyrogram.types import (
|
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
CallbackQuery,
|
|
||||||
InputMediaPhoto,
|
|
||||||
)
|
|
||||||
from pyrogram.errors import MessageNotModified, MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty
|
|
||||||
from deep_translator import GoogleTranslator
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from deep_translator import GoogleTranslator
|
||||||
|
from pykeyboard import InlineButton, InlineKeyboard
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from misskaty import app, BOT_USERNAME
|
from pyrogram.errors import MediaEmpty, MessageNotModified, PhotoInvalidDimensions, WebpageMediaEmpty
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto
|
||||||
|
from misskaty import BOT_USERNAME, app
|
||||||
from misskaty.core.decorator.errors import capture_err
|
from misskaty.core.decorator.errors import capture_err
|
||||||
from misskaty.helper.tools import GENRES_EMOJI, get_random_string
|
|
||||||
from misskaty.helper.http import http
|
from misskaty.helper.http import http
|
||||||
|
from misskaty.helper.tools import GENRES_EMOJI, get_random_string
|
||||||
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
from utils import demoji
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
LIST_CARI = {}
|
LIST_CARI = {}
|
||||||
|
|
||||||
|
|
||||||
# IMDB Choose Language
|
# IMDB Choose Language
|
||||||
@app.on_message(filters.command(["imdb"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["imdb"], COMMAND_HANDLER))
|
||||||
@capture_err
|
@capture_err
|
||||||
|
|
@ -43,8 +41,7 @@ async def imdb_choose(_, m):
|
||||||
)
|
)
|
||||||
await m.reply_photo(
|
await m.reply_photo(
|
||||||
"https://telegra.ph/file/270955ef0d1a8a16831a9.jpg",
|
"https://telegra.ph/file/270955ef0d1a8a16831a9.jpg",
|
||||||
caption=
|
caption=f"Hi {m.from_user.mention}, Please select the language you want to use on IMDB Search.\n\nSilakan pilih bahasa yang ingin Anda gunakan di Pencarian IMDB.",
|
||||||
f"Hi {m.from_user.mention}, Please select the language you want to use on IMDB Search.\n\nSilakan pilih bahasa yang ingin Anda gunakan di Pencarian IMDB.",
|
|
||||||
reply_markup=buttons,
|
reply_markup=buttons,
|
||||||
quote=True,
|
quote=True,
|
||||||
)
|
)
|
||||||
|
|
@ -55,22 +52,22 @@ async def imdbcari_id(client, query):
|
||||||
BTN = []
|
BTN = []
|
||||||
i, msg, uid = query.data.split("#")
|
i, msg, uid = query.data.split("#")
|
||||||
if query.from_user.id != int(uid):
|
if query.from_user.id != int(uid):
|
||||||
return await query.answer(f"⚠️ Akses Ditolak!", True)
|
return await query.answer("⚠️ Akses Ditolak!", True)
|
||||||
try:
|
try:
|
||||||
kueri = LIST_CARI.get(msg)
|
kueri = LIST_CARI.get(msg)
|
||||||
del LIST_CARI[msg]
|
del LIST_CARI[msg]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return await query.message.edit_caption(f"⚠️ Callback Query Sudah Expired!")
|
return await query.message.edit_caption("⚠️ Callback Query Sudah Expired!")
|
||||||
await query.message.edit_caption("<i>🔎 Sedang mencari di Database IMDB..</i>")
|
await query.message.edit_caption("<i>🔎 Sedang mencari di Database IMDB..</i>")
|
||||||
msg = ""
|
msg = ""
|
||||||
buttons = InlineKeyboard(row_width=4)
|
buttons = InlineKeyboard(row_width=4)
|
||||||
try:
|
try:
|
||||||
r = await http.get(f"https://yasirapi.eu.org/imdb-search?q={kueri}"
|
r = await http.get(f"https://yasirapi.eu.org/imdb-search?q={kueri}")
|
||||||
)
|
|
||||||
res = json.loads(r.text).get("result")
|
res = json.loads(r.text).get("result")
|
||||||
if not res:
|
if not res:
|
||||||
return await query.message.edit_caption(
|
return await query.message.edit_caption(
|
||||||
f"⛔️ Tidak ditemukan hasil untuk kueri: <code>{kueri}</code>")
|
f"⛔️ Tidak ditemukan hasil untuk kueri: <code>{kueri}</code>"
|
||||||
|
)
|
||||||
msg += f"🎬 Ditemukan ({len(res)}) hasil dari: <code>{kueri}</code> ~ {query.from_user.mention}\n\n"
|
msg += f"🎬 Ditemukan ({len(res)}) hasil dari: <code>{kueri}</code> ~ {query.from_user.mention}\n\n"
|
||||||
for num, movie in enumerate(res, start=1):
|
for num, movie in enumerate(res, start=1):
|
||||||
title = movie.get("l")
|
title = movie.get("l")
|
||||||
|
|
@ -80,9 +77,10 @@ async def imdbcari_id(client, query):
|
||||||
msg += f"{num}. {title} {year} - {type}\n"
|
msg += f"{num}. {title} {year} - {type}\n"
|
||||||
BTN.append(
|
BTN.append(
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
text=num, callback_data=f"imdbres_id#{uid}#{movieID}"))
|
text=num, callback_data=f"imdbres_id#{uid}#{movieID}"
|
||||||
BTN.append(
|
)
|
||||||
InlineKeyboardButton(text="❌ Close", callback_data=f"close#{uid}"))
|
)
|
||||||
|
BTN.append(InlineKeyboardButton(text="❌ Close", callback_data=f"close#{uid}"))
|
||||||
buttons.add(*BTN)
|
buttons.add(*BTN)
|
||||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
@ -106,12 +104,12 @@ async def imdbcari_en(client, query):
|
||||||
msg = ""
|
msg = ""
|
||||||
buttons = InlineKeyboard(row_width=4)
|
buttons = InlineKeyboard(row_width=4)
|
||||||
try:
|
try:
|
||||||
r = await http.get(f"https://yasirapi.eu.org/imdb-search?q={kueri}"
|
r = await http.get(f"https://yasirapi.eu.org/imdb-search?q={kueri}")
|
||||||
)
|
|
||||||
res = json.loads(r.text).get("result")
|
res = json.loads(r.text).get("result")
|
||||||
if not res:
|
if not res:
|
||||||
return await query.message.edit_caption(
|
return await query.message.edit_caption(
|
||||||
f"⛔️ Result not found for keywords: <code>{kueri}</code>")
|
f"⛔️ Result not found for keywords: <code>{kueri}</code>"
|
||||||
|
)
|
||||||
msg += f"🎬 Found ({len(res)}) result for keywords: <code>{kueri}</code> ~ {query.from_user.mention}\n\n"
|
msg += f"🎬 Found ({len(res)}) result for keywords: <code>{kueri}</code> ~ {query.from_user.mention}\n\n"
|
||||||
for num, movie in enumerate(res, start=1):
|
for num, movie in enumerate(res, start=1):
|
||||||
title = movie.get("l")
|
title = movie.get("l")
|
||||||
|
|
@ -119,8 +117,16 @@ async def imdbcari_en(client, query):
|
||||||
type = movie.get("q").replace("feature", "movie").capitalize()
|
type = movie.get("q").replace("feature", "movie").capitalize()
|
||||||
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
movieID = re.findall(r"tt(\d+)", movie.get("id"))[0]
|
||||||
msg += f"{num}. {title} {year} - {type}\n"
|
msg += f"{num}. {title} {year} - {type}\n"
|
||||||
BTN.append(InlineKeyboardButton(text=num, callback_data=f"imdbres_en#{query.from_user.id}#{movieID}"))
|
BTN.append(
|
||||||
BTN.append(InlineKeyboardButton(text="❌ Close", callback_data=f"close#{query.from_user.id}"))
|
InlineKeyboardButton(
|
||||||
|
text=num, callback_data=f"imdbres_en#{query.from_user.id}#{movieID}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
BTN.append(
|
||||||
|
InlineKeyboardButton(
|
||||||
|
text="❌ Close", callback_data=f"close#{query.from_user.id}"
|
||||||
|
)
|
||||||
|
)
|
||||||
buttons.add(*BTN)
|
buttons.add(*BTN)
|
||||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
@ -135,28 +141,27 @@ async def imdb_id_callback(bot, query):
|
||||||
if query.from_user.id != int(userid):
|
if query.from_user.id != int(userid):
|
||||||
return await query.answer("⚠️ Akses Ditolak!", True)
|
return await query.answer("⚠️ Akses Ditolak!", True)
|
||||||
try:
|
try:
|
||||||
await query.message.edit_caption("⏳ Permintaan kamu sedang diproses.. "
|
await query.message.edit_caption("⏳ Permintaan kamu sedang diproses.. ")
|
||||||
)
|
|
||||||
url = f"https://www.imdb.com/title/tt{movie}/"
|
url = f"https://www.imdb.com/title/tt{movie}/"
|
||||||
resp = await http.get(
|
resp = await http.get(
|
||||||
url,
|
url,
|
||||||
headers={
|
headers={
|
||||||
"User-Agent":
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10"
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10"
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
sop = BeautifulSoup(resp, "lxml")
|
sop = BeautifulSoup(resp, "lxml")
|
||||||
r_json = json.loads(
|
r_json = json.loads(
|
||||||
sop.find("script", attrs={
|
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||||
"type": "application/ld+json"
|
)
|
||||||
}).contents[0])
|
|
||||||
res_str = ""
|
res_str = ""
|
||||||
type = f"<code>{r_json['@type']}</code>" if r_json.get("@type") else ""
|
type = f"<code>{r_json['@type']}</code>" if r_json.get("@type") else ""
|
||||||
if r_json.get("name"):
|
if r_json.get("name"):
|
||||||
try:
|
try:
|
||||||
tahun = (sop.select(
|
tahun = (
|
||||||
'ul[data-testid="hero-title-block__metadata"]')[0].find(
|
sop.select('ul[data-testid="hero-title-block__metadata"]')[0]
|
||||||
class_="sc-8c396aa2-2 itZqyK").text)
|
.find(class_="sc-8c396aa2-2 itZqyK")
|
||||||
|
.text
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
tahun = "-"
|
tahun = "-"
|
||||||
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{type}</code>)\n"
|
res_str += f"<b>📹 Judul:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{type}</code>)\n"
|
||||||
|
|
@ -166,8 +171,10 @@ async def imdb_id_callback(bot, query):
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if sop.select('li[data-testid="title-techspec_runtime"]'):
|
if sop.select('li[data-testid="title-techspec_runtime"]'):
|
||||||
durasi = (
|
durasi = (
|
||||||
sop.select('li[data-testid="title-techspec_runtime"]')[0].find(
|
sop.select('li[data-testid="title-techspec_runtime"]')[0]
|
||||||
class_="ipc-metadata-list-item__content-container").text)
|
.find(class_="ipc-metadata-list-item__content-container")
|
||||||
|
.text
|
||||||
|
)
|
||||||
res_str += f"<b>Durasi:</b> <code>{GoogleTranslator('auto', 'id').translate(durasi)}</code>\n"
|
res_str += f"<b>Durasi:</b> <code>{GoogleTranslator('auto', 'id').translate(durasi)}</code>\n"
|
||||||
if r_json.get("contentRating"):
|
if r_json.get("contentRating"):
|
||||||
res_str += f"<b>Kategori:</b> <code>{r_json['contentRating']}</code> \n"
|
res_str += f"<b>Kategori:</b> <code>{r_json['contentRating']}</code> \n"
|
||||||
|
|
@ -199,25 +206,27 @@ async def imdb_id_callback(bot, query):
|
||||||
else:
|
else:
|
||||||
genre += f"#{i.replace('-', '_').replace(' ', '_')}, "
|
genre += f"#{i.replace('-', '_').replace(' ', '_')}, "
|
||||||
genre = genre[:-2]
|
genre = genre[:-2]
|
||||||
res_str += f"<b>Genre:</b> {genre}\n"
|
res_str += f"<b>Genre :</b> {genre}\n"
|
||||||
if sop.select('li[data-testid="title-details-origin"]'):
|
if sop.select('li[data-testid="title-details-origin"]'):
|
||||||
country = "".join(
|
country = "".join(
|
||||||
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
||||||
for country in sop.
|
for country in sop.select('li[data-testid="title-details-origin"]')[
|
||||||
select('li[data-testid="title-details-origin"]')[0].findAll(
|
0
|
||||||
class_=
|
].findAll(
|
||||||
"ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
))
|
)
|
||||||
|
)
|
||||||
country = country[:-2]
|
country = country[:-2]
|
||||||
res_str += f"<b>Negara:</b> {country}\n"
|
res_str += f"<b>Negara:</b> {country}\n"
|
||||||
if sop.select('li[data-testid="title-details-languages"]'):
|
if sop.select('li[data-testid="title-details-languages"]'):
|
||||||
language = "".join(
|
language = "".join(
|
||||||
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
||||||
for lang in sop.
|
for lang in sop.select('li[data-testid="title-details-languages"]')[
|
||||||
select('li[data-testid="title-details-languages"]')[0].findAll(
|
0
|
||||||
class_=
|
].findAll(
|
||||||
"ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
))
|
)
|
||||||
|
)
|
||||||
language = language[:-2]
|
language = language[:-2]
|
||||||
res_str += f"<b>Bahasa:</b> {language}\n"
|
res_str += f"<b>Bahasa:</b> {language}\n"
|
||||||
res_str += "\n<b>🙎 Info Cast:</b>\n"
|
res_str += "\n<b>🙎 Info Cast:</b>\n"
|
||||||
|
|
@ -248,7 +257,8 @@ async def imdb_id_callback(bot, query):
|
||||||
res_str += f"<b>Pemeran:</b> {actors}\n\n"
|
res_str += f"<b>Pemeran:</b> {actors}\n\n"
|
||||||
if r_json.get("description"):
|
if r_json.get("description"):
|
||||||
summary = GoogleTranslator("auto", "id").translate(
|
summary = GoogleTranslator("auto", "id").translate(
|
||||||
r_json.get("description"))
|
r_json.get("description")
|
||||||
|
)
|
||||||
res_str += f"<b>📜 Plot: </b> <code>{summary}</code>\n\n"
|
res_str += f"<b>📜 Plot: </b> <code>{summary}</code>\n\n"
|
||||||
if r_json.get("keywords"):
|
if r_json.get("keywords"):
|
||||||
keywords = r_json["keywords"].split(",")
|
keywords = r_json["keywords"].split(",")
|
||||||
|
|
@ -260,34 +270,46 @@ async def imdb_id_callback(bot, query):
|
||||||
res_str += f"<b>🔥 Kata Kunci:</b> {key_} \n"
|
res_str += f"<b>🔥 Kata Kunci:</b> {key_} \n"
|
||||||
if sop.select('li[data-testid="award_information"]'):
|
if sop.select('li[data-testid="award_information"]'):
|
||||||
awards = (
|
awards = (
|
||||||
sop.select('li[data-testid="award_information"]')[0].find(
|
sop.select('li[data-testid="award_information"]')[0]
|
||||||
class_="ipc-metadata-list-item__list-content-item").text)
|
.find(class_="ipc-metadata-list-item__list-content-item")
|
||||||
|
.text
|
||||||
|
)
|
||||||
res_str += f"<b>🏆 Penghargaan:</b> <code>{GoogleTranslator('auto', 'id').translate(awards)}</code>\n\n"
|
res_str += f"<b>🏆 Penghargaan:</b> <code>{GoogleTranslator('auto', 'id').translate(awards)}</code>\n\n"
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
res_str += f"<b>©️ IMDb by</b> @{BOT_USERNAME}"
|
res_str += f"<b>©️ IMDb by</b> @{BOT_USERNAME}"
|
||||||
if r_json.get("trailer"):
|
if r_json.get("trailer"):
|
||||||
trailer_url = r_json["trailer"]["url"]
|
trailer_url = r_json["trailer"]["url"]
|
||||||
markup = InlineKeyboardMarkup([[
|
markup = InlineKeyboardMarkup(
|
||||||
InlineKeyboardButton(
|
[
|
||||||
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"),
|
[
|
||||||
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
|
InlineKeyboardButton(
|
||||||
]])
|
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"
|
||||||
|
),
|
||||||
|
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
markup = InlineKeyboardMarkup([[
|
markup = InlineKeyboardMarkup(
|
||||||
InlineKeyboardButton(
|
[
|
||||||
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}")
|
[
|
||||||
]])
|
InlineKeyboardButton(
|
||||||
|
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
if thumb := r_json.get("image"):
|
if thumb := r_json.get("image"):
|
||||||
try:
|
try:
|
||||||
await query.message.edit_media(InputMediaPhoto(
|
await query.message.edit_media(
|
||||||
thumb, caption=res_str),
|
InputMediaPhoto(thumb, caption=res_str), reply_markup=markup
|
||||||
reply_markup=markup)
|
)
|
||||||
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
||||||
poster = thumb.replace(".jpg", "._V1_UX360.jpg")
|
poster = thumb.replace(".jpg", "._V1_UX360.jpg")
|
||||||
await query.message.edit_media(InputMediaPhoto(
|
await query.message.edit_media(
|
||||||
poster, caption=res_str),
|
InputMediaPhoto(poster, caption=res_str), reply_markup=markup
|
||||||
reply_markup=markup)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
await query.message.edit_caption(res_str, reply_markup=markup)
|
await query.message.edit_caption(res_str, reply_markup=markup)
|
||||||
else:
|
else:
|
||||||
|
|
@ -310,17 +332,22 @@ async def imdb_en_callback(bot, query):
|
||||||
resp = await http.get(
|
resp = await http.get(
|
||||||
url,
|
url,
|
||||||
headers={
|
headers={
|
||||||
"User-Agent":
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10"
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10"
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
sop = BeautifulSoup(resp, "lxml")
|
sop = BeautifulSoup(resp, "lxml")
|
||||||
r_json = json.loads(sop.find("script", attrs={"type": "application/ld+json"}).contents[0])
|
r_json = json.loads(
|
||||||
|
sop.find("script", attrs={"type": "application/ld+json"}).contents[0]
|
||||||
|
)
|
||||||
res_str = ""
|
res_str = ""
|
||||||
type = f"<code>{r_json['@type']}</code>" if r_json.get("@type") else ""
|
type = f"<code>{r_json['@type']}</code>" if r_json.get("@type") else ""
|
||||||
if r_json.get("name"):
|
if r_json.get("name"):
|
||||||
try:
|
try:
|
||||||
tahun = sop.select('ul[data-testid="hero-title-block__metadata"]')[0].find(class_="sc-8c396aa2-2 itZqyK").text
|
tahun = (
|
||||||
|
sop.select('ul[data-testid="hero-title-block__metadata"]')[0]
|
||||||
|
.find(class_="sc-8c396aa2-2 itZqyK")
|
||||||
|
.text
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
tahun = "-"
|
tahun = "-"
|
||||||
res_str += f"<b>📹 Title:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{type}</code>)\n"
|
res_str += f"<b>📹 Title:</b> <a href='{url}'>{r_json['name']} [{tahun}]</a> (<code>{type}</code>)\n"
|
||||||
|
|
@ -329,21 +356,39 @@ async def imdb_en_callback(bot, query):
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
if sop.select('li[data-testid="title-techspec_runtime"]'):
|
if sop.select('li[data-testid="title-techspec_runtime"]'):
|
||||||
durasi = sop.select('li[data-testid="title-techspec_runtime"]')[0].find(class_="ipc-metadata-list-item__content-container").text
|
durasi = (
|
||||||
|
sop.select('li[data-testid="title-techspec_runtime"]')[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__content-container")
|
||||||
|
.text
|
||||||
|
)
|
||||||
res_str += f"<b>Duration:</b> <code>{durasi}</code>\n"
|
res_str += f"<b>Duration:</b> <code>{durasi}</code>\n"
|
||||||
if r_json.get("contentRating"):
|
if r_json.get("contentRating"):
|
||||||
res_str += f"<b>Category:</b> <code>{r_json['contentRating']}</code> \n"
|
res_str += f"<b>Category:</b> <code>{r_json['contentRating']}</code> \n"
|
||||||
if r_json.get("aggregateRating"):
|
if r_json.get("aggregateRating"):
|
||||||
res_str += f"<b>Rating:</b> <code>{r_json['aggregateRating']['ratingValue']}⭐️ from {r_json['aggregateRating']['ratingCount']} user</code> \n"
|
res_str += f"<b>Rating:</b> <code>{r_json['aggregateRating']['ratingValue']}⭐️ from {r_json['aggregateRating']['ratingCount']} user</code> \n"
|
||||||
if sop.select('li[data-testid="title-details-releasedate"]'):
|
if sop.select('li[data-testid="title-details-releasedate"]'):
|
||||||
rilis = sop.select('li[data-testid="title-details-releasedate"]')[0].find(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link").text
|
rilis = (
|
||||||
rilis_url = sop.select('li[data-testid="title-details-releasedate"]')[0].find(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")["href"]
|
sop.select('li[data-testid="title-details-releasedate"]')[0]
|
||||||
|
.find(
|
||||||
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
|
)
|
||||||
|
.text
|
||||||
|
)
|
||||||
|
rilis_url = sop.select('li[data-testid="title-details-releasedate"]')[
|
||||||
|
0
|
||||||
|
].find(
|
||||||
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
|
)[
|
||||||
|
"href"
|
||||||
|
]
|
||||||
res_str += f"<b>Release Data:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
res_str += f"<b>Release Data:</b> <a href='https://www.imdb.com{rilis_url}'>{rilis}</a>\n"
|
||||||
if r_json.get("genre"):
|
if r_json.get("genre"):
|
||||||
genre = ""
|
genre = ""
|
||||||
for i in r_json["genre"]:
|
for i in r_json["genre"]:
|
||||||
if i in GENRES_EMOJI:
|
if i in GENRES_EMOJI:
|
||||||
genre += f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
genre += (
|
||||||
|
f"{GENRES_EMOJI[i]} #{i.replace('-', '_').replace(' ', '_')}, "
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
genre += f"#{i.replace('-', '_').replace(' ', '_')}, "
|
genre += f"#{i.replace('-', '_').replace(' ', '_')}, "
|
||||||
genre = genre[:-2]
|
genre = genre[:-2]
|
||||||
|
|
@ -351,13 +396,22 @@ async def imdb_en_callback(bot, query):
|
||||||
if sop.select('li[data-testid="title-details-origin"]'):
|
if sop.select('li[data-testid="title-details-origin"]'):
|
||||||
country = "".join(
|
country = "".join(
|
||||||
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
f"{demoji(country.text)} #{country.text.replace(' ', '_').replace('-', '_')}, "
|
||||||
for country in sop.select('li[data-testid="title-details-origin"]')[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
for country in sop.select('li[data-testid="title-details-origin"]')[
|
||||||
|
0
|
||||||
|
].findAll(
|
||||||
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
country = country[:-2]
|
country = country[:-2]
|
||||||
res_str += f"<b>Country:</b> {country}\n"
|
res_str += f"<b>Country:</b> {country}\n"
|
||||||
if sop.select('li[data-testid="title-details-languages"]'):
|
if sop.select('li[data-testid="title-details-languages"]'):
|
||||||
language = "".join(
|
language = "".join(
|
||||||
f"#{lang.text.replace(' ', '_').replace('-', '_')}, " for lang in sop.select('li[data-testid="title-details-languages"]')[0].findAll(class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link")
|
f"#{lang.text.replace(' ', '_').replace('-', '_')}, "
|
||||||
|
for lang in sop.select('li[data-testid="title-details-languages"]')[
|
||||||
|
0
|
||||||
|
].findAll(
|
||||||
|
class_="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
language = language[:-2]
|
language = language[:-2]
|
||||||
res_str += f"<b>Language:</b> {language}\n"
|
res_str += f"<b>Language:</b> {language}\n"
|
||||||
|
|
@ -398,7 +452,11 @@ async def imdb_en_callback(bot, query):
|
||||||
key_ = key_[:-2]
|
key_ = key_[:-2]
|
||||||
res_str += f"<b>🔥 Keywords:</b> {key_} \n"
|
res_str += f"<b>🔥 Keywords:</b> {key_} \n"
|
||||||
if sop.select('li[data-testid="award_information"]'):
|
if sop.select('li[data-testid="award_information"]'):
|
||||||
awards = sop.select('li[data-testid="award_information"]')[0].find(class_="ipc-metadata-list-item__list-content-item").text
|
awards = (
|
||||||
|
sop.select('li[data-testid="award_information"]')[0]
|
||||||
|
.find(class_="ipc-metadata-list-item__list-content-item")
|
||||||
|
.text
|
||||||
|
)
|
||||||
res_str += f"<b>🏆 Awards:</b> <code>{awards}</code>\n\n"
|
res_str += f"<b>🏆 Awards:</b> <code>{awards}</code>\n\n"
|
||||||
else:
|
else:
|
||||||
res_str += "\n"
|
res_str += "\n"
|
||||||
|
|
@ -408,17 +466,33 @@ async def imdb_en_callback(bot, query):
|
||||||
markup = InlineKeyboardMarkup(
|
markup = InlineKeyboardMarkup(
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
InlineKeyboardButton("🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"),
|
InlineKeyboardButton(
|
||||||
|
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"
|
||||||
|
),
|
||||||
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
|
InlineKeyboardButton("▶️ Trailer", url=trailer_url),
|
||||||
]])
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}")]])
|
markup = InlineKeyboardMarkup(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
InlineKeyboardButton(
|
||||||
|
"🎬 Open IMDB", url=f"https://www.imdb.com{r_json['url']}"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
if thumb := r_json.get("image"):
|
if thumb := r_json.get("image"):
|
||||||
try:
|
try:
|
||||||
await query.message.edit_media(InputMediaPhoto(thumb, caption=res_str), reply_markup=markup)
|
await query.message.edit_media(
|
||||||
|
InputMediaPhoto(thumb, caption=res_str), reply_markup=markup
|
||||||
|
)
|
||||||
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
except (MediaEmpty, PhotoInvalidDimensions, WebpageMediaEmpty):
|
||||||
poster = thumb.replace(".jpg", "._V1_UX360.jpg")
|
poster = thumb.replace(".jpg", "._V1_UX360.jpg")
|
||||||
await query.message.edit_media(InputMediaPhoto(poster, caption=res_str), reply_markup=markup)
|
await query.message.edit_media(
|
||||||
|
InputMediaPhoto(poster, caption=res_str), reply_markup=markup
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
await query.message.edit_caption(res_str, reply_markup=markup)
|
await query.message.edit_caption(res_str, reply_markup=markup)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,21 @@
|
||||||
* @projectName MissKatyPyro
|
* @projectName MissKatyPyro
|
||||||
* Copyright @YasirPedia All rights reserved
|
* Copyright @YasirPedia All rights reserved
|
||||||
"""
|
"""
|
||||||
import io
|
|
||||||
from os import remove as osremove
|
|
||||||
import time
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import io
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
|
from os import remove as osremove
|
||||||
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|
||||||
from pyrogram.errors import FloodWait
|
from pyrogram.errors import FloodWait
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from utils import get_file_id
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.helper.media_helper import post_to_telegraph, runcmd
|
from misskaty.helper.media_helper import post_to_telegraph, runcmd
|
||||||
from misskaty.helper.pyro_progress import progress_for_pyrogram
|
from misskaty.helper.pyro_progress import progress_for_pyrogram
|
||||||
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
from utils import get_file_id
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command(["mediainfo"], COMMAND_HANDLER))
|
@app.on_message(filters.command(["mediainfo"], COMMAND_HANDLER))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue