from threading import *
import requests
import time
import telebot
from bs4 import BeautifulSoup as b
URL = 'site'
API_KEY = 'key'
bot = telebot.TeleBot(API_KEY)
x = ''
def get_requests(x):
while True:
r = requests.get(URL)
soup = b(r.text, 'html.parser')
data1 = soup.find_all('textarea', class_='form-control')
data2 = [c.text for c in data1 ]
s = ''.join(data2 )
data3 = s[38:]
data4=data3.split("\n")
global part1
global part2
part1, part2 = "\n".join(data4[:len(data4)//2]), "\n".join(data4[len(data4)//2:])
time.sleep(60)
if __name__ == '__main__':
start_get_requests = Thread(target=get_requests, args =(x,))
start_get_requests.start()
@bot.message_handler(commands=["start"])
def start(m, res=False):
bot.send_message(m.chat.id, 'Type /now')
@bot.message_handler(commands=['now', 'Now', 'NOW'])
def answer(message):
bot.send_message(message.chat.id, part1)
bot.send_message(message.chat.id, part2)
bot.polling()
r = requests.get(URL)
soup = b(r.text, 'html.parser')
data1 = soup.find_all('textarea', class_='form-control')
data2 = [c.text for c in data1 ]
s = ''.join(data2 )
data3 = s[38:]
data4=data3.split("\n")
part1, part2 = "\n".join(data4[:len(data4)//2]), "\n".join(data4[len(data4)//2:])
import requests
import telebot
from bs4 import BeautifulSoup as b
URL = 'site'
API_KEY = 'key'
r = requests.get(URL)
soup = b(r.text, 'html.parser')
data1 = soup.find_all('textarea', class_='form-control')
data2 = [c.text for c in data1 ]
s = ''.join(data2 )
data3 = s[38:]
data4=data3.split("\n")
part1, part2 = "\n".join(data4[:len(data4)//2]), "\n".join(data4[len(data4)//2:])
bot = telebot.TeleBot(API_KEY)
@bot.message_handler(commands=["start"])
def start(m, res=False):
bot.send_message(m.chat.id, 'Type /now and get a list')
@bot.message_handler(commands=['now'])
def answer(message):
bot.send_message(message.chat.id, part1)
bot.send_message(message.chat.id, part2)
bot.polling()