gpt-3.5-turbo-0125· OpenAI
WildChat-4.8M (AI2)
Create a python source code for telegram bot for drm video extractor from TXt file's URLs
- User
Create a python source code for telegram bot for drm video extractor from TXt file's URLs
- Assistant
import telebot import requests import re
API_TOKEN = 'Your_API_Token_Here' # Insert your Telegram Bot API Token here bot = telebot.TeleBot(API_TOKEN)
@bot.message_handler(commands=['start']) def send_welcome(message): bot.reply_to(message, "Welcome! Send me a .txt file with URLs of videos to extract DRM.")
@bot.message_handler(content_types=['document']) def handle_file(message): file_info = bot.get_file(message.document.file_id) file_url = f'https://api.telegram.org/file/bot{API_TOKEN}/{file_info.file_path}'
response = requests.get(file_url) urls = re.findall(r'(https?://\S+)', response.text) video_urls = [url for url in urls if url.endswith('.mp4') and 'drm' in url] if video_urls: bot.reply_to(message, f"Found {len(video_urls)} DRM video URLs:") for video_url in video_urls: bot.send_message(message.chat.id, video_url) else: bot.reply_to(message, "No DRM video URLs found in the file.")bot.polling()