""" import requests import telebot from requests_html import HTMLSession from selectolax.parser import HTMLParser bot=telebot.TeleBot("6064660172:AAGFsuJeicJ-qBcxWU0eqfBtJQbR6EmUGJY") session=HTMLSession() s=session.get("https://hormozgan.ac.ir/home/index/6/16/998") node=HTMLParser(s.content) newslist=[] newslink=[] for i in node.css('.accordion .sub-nav a'): newslist.append(i.text()) newslink.append("https://hormozgan.ac.ir"+i.attributes.get('href')) button=[] def get_buttons(): buttons = telebot.types.ReplyKeyboardMarkup(row_width=2) for i,news in enumerate(newslist): buttons.add(telebot.types.KeyboardButton(news)) return buttons @bot.message_handler(commands=['start']) def start(message): buttons = get_buttons() bot.send_message(message.chat.id, 'Choose a button:', reply_markup=buttons) print(newslist[0]) @bot.message_handler() def keyboard(message): for i,news in enumerate(newslink): if message.text ==newslist[i]: bot.send_message(message.chat.id,newslink[i]) @bot.message_handler(commands=['help']) def send_help(message): bot.reply_to(message,"Can I help you?") bot.infinity_polling() """