import telebot
import requests
import os
TOKEN = "Bot_tokin_yozing"
bot = telebot.TeleBot(TOKEN)
HTML = "HTML"
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(
message.chat.id,
"<tg-emoji emoji-id='5798587088077066898'>π»</tg-emoji> Salom Menga (Qr-kod) yuboring men uni ichida nima boriligini aniqlab beraman.",
parse_mode=HTML
)
@bot.message_handler(content_types=['photo'])
def qr(message):
try:
file = bot.get_file(message.photo[-1].file_id)
img = bot.download_file(file.file_path)
with open("qr.png", "wb") as f:
f.write(img)
r = requests.post(
"https://api.qrserver.com/v1/read-qr-code/",
files={
"file": open("qr.png", "rb")
},
timeout=15
)
result = r.json()[0]["symbol"][0]["data"]
if result:
bot.send_message(
message.chat.id,
"<tg-emoji emoji-id='5852804431644465571'>π»</tg-emoji> QR topildi:\n\n<code>"+result+"</code>",
parse_mode=HTML
)
else:
bot.send_message(
message.chat.id,
"<tg-emoji emoji-id='5855064567989673201'>π»</tg-emoji> QR topilmadi",
parse_mode=HTML
)
except Exception as e:
bot.send_message(
message.chat.id,
"<tg-emoji emoji-id='5447644880824181073'>π»</tg-emoji> O'qishda xato",
parse_mode=HTML
)
if os.path.exists("qr.png"):
os.remove("qr.png")
@bot.message_handler(content_types=['text'])
def text_reply(message):
bot.send_message(
message.chat.id,
"<tg-emoji emoji-id='5978817028352381016'>π»</tg-emoji> Siz yozdingiz:\n\n<code>"
+ message.text +
"</code>",
parse_mode=HTML
)
bot.infinity_polling()
Please open Telegram to view this post
VIEW IN TELEGRAM
O'zbek PHP
import telebot import requests import os TOKEN = "Bot_tokin_yozing" bot = telebot.TeleBot(TOKEN) HTML = "HTML" @bot.message_handler(commands=['start']) def start(message): bot.send_message( message.chat.id, "<tg-emoji emoji-id='57β¦
Kerak bo'lib qolar π
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from .
Telegram stars
Premium obunasini va starlar akkauntingizga kirmasdan, βsovgβaβ koβrinishida ulab beramiz.
@omirbayev_xvk
β’ Ishonchli β’ Tezkor β’ Hamyonbop
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
import telebot
import yt_dlp
import os
TOKEN = 'Bot_tokin_yozing'
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Salom π\nMenga Instagram reels yoki video havolasni yuboring men uni yuklab beraman.")
@bot.message_handler(func=lambda message: 'instagram.com' in message.text)
def download_instagram_video(message):
url = message.text
msg = bot.reply_to(message, "β³ Video yuklanmoqda iltimos kuting...")
ydl_opts = {
'outtmpl': 'video_%(id)s.%(ext)s',
'format': 'best',
'quiet': True,
'http_headers': {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
}
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=True)
filename = ydl.prepare_filename(info)
with open(filename, 'rb') as video:
bot.send_video(
chat_id=message.chat.id,
video=video,
reply_to_message_id=message.message_id
)
bot.delete_message(message.chat.id, msg.message_id)
os.remove(filename)
except Exception as e:
bot.delete_message(message.chat.id, msg.message_id)
bot.reply_to(message, "β Kechirasiz videoni yuklab olishda xatolik yuz berdi. Iltmos qaytatdan harakat qlib ko'ring")
@bot.message_handler(func=lambda message: 'instagram.com' not in message.text)
def handle_other_messages(message):
bot.reply_to(message, "Iltimos, faqat Instagram video havolasini yuboring.")
if __name__ == "__main__":
print("Bot ishga tushdi...")
bot.polling(none_stop=True)
pip install pyTelegramBotAPI yt-dlp
Please open Telegram to view this post
VIEW IN TELEGRAM
Bugun oyinda kim yutadi ? πΊπΏ vsπ΅πΉ
Anonymous Poll
54%
28%
18%
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
Kimda bo'lgan π
Please open Telegram to view this post
VIEW IN TELEGRAM