i have code in python repl and i get terms of servise eror:
import requests
import re
import html
import telebot
# Replace 'YOUR_BOT_TOKEN' with your actual bot token obtained from BotFather
bot_token = "YOUR_BOT_TOKEN"
bot = telebot.TeleBot(bot_token)
# Function to fetch vless URLs from a Telegram channel
def fetch_vless_urls(channel_name: str) -> list:
url = f"https://t.me/s/{channel_name}"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.text
# Use regular expressions to find lines starting with "vless://" and have 232 characters after them
vless_lines = re.findall(r"vless://.{232}", data)
# Decode HTML entities
decoded_urls = [html.unescape(line) for line in vless_lines]
return decoded_urls
else:
return []
# Handler for the /start command
@bot.message_handler(commands=["start"])
def start(message):
bot.reply_to(message, "aa")
# Handler for text messages
@bot.message_handler(func=lambda message: True)
def handle_message(message):
channel_name = message.text.strip()
# Fetch the vless URLs from the specified channel
vless_urls = fetch_vless_urls(channel_name)
# Send the vless URLs back to the user
if vless_urls:
for url in vless_urls:
bot.send_message(message.chat.id, url)
else:
bot.send_message(message.chat.id, f"dd")
# Start the bot
bot.polling()