import telebot
import requests
# Replace 'YOUR_BOT_TOKEN' with your actual bot token obtained from BotFather
bot = telebot.TeleBot('YOUR_BOT_TOKEN')
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Welcome to the TikTok Video Downloader Bot! Please send me a TikTok video link.")
@bot.message_handler(func=lambda message: True)
def download_video(message):
video_url = message.text
if 'tiktok.com' in video_url:
try:
response = requests.get(video_url)
video_file = response.content
bot.send_video(message.chat.id, video_file)
except:
bot.reply_to(message, "Sorry, I couldn't download the video. Please make sure the link is valid.")
else:
bot.reply_to(message, "Please send a valid TikTok video link.")
bot.polling()