mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 11:04:51 +00:00
Stable YTDL
This commit is contained in:
parent
20b7273d83
commit
5875b78285
1 changed files with 21 additions and 3 deletions
|
|
@ -82,8 +82,26 @@ async def ytdl_gendl_callback(_, cq: CallbackQuery):
|
||||||
callback = cq.data.split("|")
|
callback = cq.data.split("|")
|
||||||
key = callback[1]
|
key = callback[1]
|
||||||
if callback[0] == "yt_gen":
|
if callback[0] == "yt_gen":
|
||||||
x = await main.Extractor().get_download_button(key)
|
if match := regex.match(query):
|
||||||
await cq.edit_message_caption(caption=x.caption, reply_markup=x.buttons)
|
x = await main.Extractor().get_download_button(key)
|
||||||
|
await cq.edit_message_caption(caption=x.caption, reply_markup=x.buttons)
|
||||||
|
else:
|
||||||
|
uid = callback[2]
|
||||||
|
type_ = callback[3]
|
||||||
|
if type_ == "a":
|
||||||
|
format_ = "audio"
|
||||||
|
else:
|
||||||
|
format_ = "video"
|
||||||
|
async with iYTDL(
|
||||||
|
log_group_id=LOG_CHANNEL,
|
||||||
|
cache_path="cache",
|
||||||
|
ffmpeg_location="/usr/bin/mediaextract",
|
||||||
|
delete_media=True,
|
||||||
|
) as ytdl:
|
||||||
|
upload_key = await ytdl.download(
|
||||||
|
"https://www.youtube.com/watch?v=" + key, uid, format_, cq, True, 3
|
||||||
|
)
|
||||||
|
await ytdl.upload(app, upload_key, format_, cq, True)
|
||||||
else:
|
else:
|
||||||
uid = callback[2]
|
uid = callback[2]
|
||||||
type_ = callback[3]
|
type_ = callback[3]
|
||||||
|
|
@ -98,7 +116,7 @@ async def ytdl_gendl_callback(_, cq: CallbackQuery):
|
||||||
delete_media=True,
|
delete_media=True,
|
||||||
) as ytdl:
|
) as ytdl:
|
||||||
upload_key = await ytdl.download(
|
upload_key = await ytdl.download(
|
||||||
"https://www.youtube.com/watch?v="+key, uid, format_, cq, True, 3
|
"https://www.youtube.com/watch?v=" + key, uid, format_, cq, True, 3
|
||||||
)
|
)
|
||||||
await ytdl.upload(app, upload_key, format_, cq, True)
|
await ytdl.upload(app, upload_key, format_, cq, True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue