Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. import telebot
  2. import requests
  3. from bs4 import BeautifulSoup
  4.  
  5. url = "https://www.nbrb.by/statistics/rates/ratesdaily.asp"
  6.  
  7. def cours():
  8.     url = "https://afisha.tut.by/day/2019/10/24"  
  9.     req = requests.get(url)
  10.     page = req.text
  11.     soup = BeautifulSoup(page,"lxml")
  12.     catalog = []
  13.     ivents = soup.findAll('div', attrs= {'class' : 'm-b-border tab-pane active'})
  14.     for films in ivents:
  15.         films = films.findAll('a', attrs= {'class' : 'name'})
  16.         for film in films:
  17.             film = film.text
  18.             catalog.append(film)
  19.     return catalog
  20. r = cours()
  21.  
  22.  
  23.  
  24. keyboard1 = telebot.types.ReplyKeyboardMarkup(True, True)
  25. keyboard1.row('Movies' , 'Courses')
  26. bot = telebot.TeleBot('TOKEN')
  27. @bot.message_handler(commands=['go'])
  28.  
  29. def start_message(message):
  30.     bot.send_message(message.chat.id,'Здарова,братан', reply_markup=keyboard1)
  31.  
  32. @bot.message_handler(content_types=['text'])
  33. def send_message(message):
  34.     if message.text.lower() == 'usd':
  35.         mov = []
  36.         for i in r:
  37.             mov.append(i)
  38.         bot.send_message(message.chat.id, mov)
  39.  
  40. bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement