mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-04 11:24:50 +00:00
tes2
This commit is contained in:
parent
c0acda9f49
commit
9bfffb55e5
2 changed files with 27 additions and 6 deletions
|
|
@ -262,7 +262,13 @@ async def imdbcari(self: Client, query: CallbackQuery):
|
|||
)
|
||||
)
|
||||
buttons.add(*BTN)
|
||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||
msg = await query.message.edit_caption(msg, reply_markup=buttons)
|
||||
await msg.wait_for_click(
|
||||
from_user_id=int(uid),
|
||||
timeout=30
|
||||
)
|
||||
except ListenerTimeout:
|
||||
await msg.edit_caption("😶🌫️ Waktu Habis. Task Telah Dibatalkan!")
|
||||
except Exception as err:
|
||||
await query.message.edit_caption(f"Ooppss, gagal mendapatkan daftar judul di IMDb. Mungkin terkena rate limit atau down.\n\n<b>ERROR:</b> <code>{err}</code>")
|
||||
else:
|
||||
|
|
@ -301,7 +307,13 @@ async def imdbcari(self: Client, query: CallbackQuery):
|
|||
)
|
||||
)
|
||||
buttons.add(*BTN)
|
||||
await query.message.edit_caption(msg, reply_markup=buttons)
|
||||
msg = await query.message.edit_caption(msg, reply_markup=buttons)
|
||||
await msg.wait_for_click(
|
||||
from_user_id=int(uid),
|
||||
timeout=30
|
||||
)
|
||||
except ListenerTimeout:
|
||||
await msg.edit_caption("😶🌫️ Timeout. Task Has Been Cancelled!")
|
||||
except Exception as err:
|
||||
await query.message.edit_caption(f"Failed when requesting movies title. Maybe got rate limit or down.\n\n<b>ERROR:</b> <code>{err}</code>")
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ from logging import getLogger
|
|||
from re import compile as recompile
|
||||
from uuid import uuid4
|
||||
|
||||
from iytdl import iYTDL, main
|
||||
from iytdl import iYTDL, main, Process
|
||||
from iytdl.exceptions import DownloadFailedError
|
||||
from iytdl.constants import YT_VID_URL
|
||||
from pyrogram import filters, Client
|
||||
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto, Message
|
||||
|
||||
from misskaty import app
|
||||
from misskaty.core.decorator.errors import capture_err
|
||||
from misskaty.core.misskaty_patch.listen.listen import ListenerTimeout
|
||||
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||
from misskaty.helper.http import http
|
||||
from misskaty.helper.localization import use_chat_lang
|
||||
|
|
@ -69,13 +72,19 @@ async def ytdownv2(self: Client, ctx: Message, strings):
|
|||
url = ctx.input
|
||||
async with iYTDL(log_group_id=0, cache_path="cache", ffmpeg_location="/usr/bin/mediaextract") as ytdl:
|
||||
try:
|
||||
x = await ytdl.parse(url)
|
||||
x = await ytdl.parse(url, extract=True)
|
||||
if x is None:
|
||||
return await ctx.reply_msg(strings("err_parse"))
|
||||
img = await get_ytthumb(x.key)
|
||||
caption = x.caption
|
||||
markup = x.buttons
|
||||
await ctx.reply_photo(img, caption=caption, reply_markup=markup, quote=True)
|
||||
photo = x.image_url
|
||||
msg = await ctx.reply_photo(photo, caption=caption, reply_markup=markup, quote=True)
|
||||
await msg.wait_for_click(
|
||||
from_user_id=ctx.from_user.id,
|
||||
timeout=30
|
||||
)
|
||||
except ListenerTimeout:
|
||||
await msg.edit_caption("😶🌫️ Timeout. Task has been cancelled!")
|
||||
except Exception as err:
|
||||
await ctx.reply_msg(f"Opps, ERROR: {str(err)}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue