Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- import requests
- from bs4 import BeautifulSoup
- url = "https://www.nbrb.by/statistics/rates/ratesdaily.asp"
- def cours():
- url = "https://afisha.tut.by/day/2019/10/24"
- req = requests.get(url)
- page = req.text
- soup = BeautifulSoup(page,"lxml")
- catalog = []
- ivents = soup.findAll('div', attrs= {'class' : 'm-b-border tab-pane active'})
- for films in ivents:
- films = films.findAll('a', attrs= {'class' : 'name'})
- for film in films:
- film = film.text
- catalog.append(film)
- return catalog
- r = cours()
- keyboard1 = telebot.types.ReplyKeyboardMarkup(True, True)
- keyboard1.row('Movies' , 'Courses')
- bot = telebot.TeleBot('TOKEN')
- @bot.message_handler(commands=['go'])
- def start_message(message):
- bot.send_message(message.chat.id,'Здарова,братан', reply_markup=keyboard1)
- @bot.message_handler(content_types=['text'])
- def send_message(message):
- if message.text.lower() == 'usd':
- mov = []
- for i in r:
- mov.append(i)
- bot.send_message(message.chat.id, mov)
- bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement