How to make YouTube thumbnail downloader bot in telegram.
Автор: tbeh owner
Загружено: 2026-01-14
Просмотров: 81
Описание:
👇👇👇✅✅✅ command /start
m = bot.sendMessage(
"🎬 YouTube Thumbnail Downloader\n\n"
"Send youtube video link and I will download thumbnail for you.\n\n"
"Example:\n"
" • Going to Lamborghini Store in Beggar Dress! ",
parse_mode="html"
)
save start message id (for delete later)
User.saveData("start_msg_id", m["message_id"])
✅✅✅ 👇👇/command *
🤖 Ignore bot messages
if message.from_user.is_bot:
ReturnCommand()
chat_id = message.chat.id
text = (message.text or "").strip()
===== DELETE START MESSAGE =====
start_id = User.getData("start_msg_id")
if start_id:
try:
bot.deleteMessage(chat_id, start_id)
except Exception:
pass
==============================
===== DELETE USER LINK MESSAGE =====
try:
bot.deleteMessage(chat_id, message.message_id)
except Exception:
pass
====================================
===== BASIC URL VALIDATION =====
if not text.startswith("http"):
bot.sendMessage(
"INVALID URL\n\n"
"Send a valid YouTube video link",
parse_mode="html"
)
ReturnCommand()
===== API CALL =====
api_url = "https://old-studio-thum-down.oldhacke..." + encodeURIComponent(text)
resp = HTTP.get(api_url)
if resp.status_code != 200:
bot.sendMessage("Failed to fetch thumbnail", parse_mode="html")
ReturnCommand()
data = resp.json()
if data.get("status") != "success":
bot.sendMessage("Invalid YouTube link", parse_mode="html")
ReturnCommand()
thumbs = data.get("thumbnails", {})
buttons = []
if thumbs.get("maxres"):
buttons.append([{ "text": "MAX RES", "url": thumbs.get("maxres") }])
if thumbs.get("hd"):
buttons.append([{ "text": "HD", "url": thumbs.get("hd") }])
if thumbs.get("medium"):
buttons.append([{ "text": "MEDIUM", "url": thumbs.get("medium") }])
if thumbs.get("sd"):
buttons.append([{ "text": "SD", "url": thumbs.get("sd") }])
if thumbs.get("default"):
buttons.append([{ "text": "DEFAULT", "url": thumbs.get("default") }])
bot.sendMessage(
"Youtube video thumbnail downloaded successfully\n\n"
"Choose photo resolution and save",
parse_mode="html",
reply_markup={"inline_keyboard": buttons}
)
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: