Answer the question
In order to leave comments, you need to log in
The bot does not send a message in the form of a dictionary, what should I do?
Hello everyone, I wanted to make a bot for myself that parses various data from the site, and sends information in the form of a dictionary, a message in a telegram, but for some reason it only sends the 'Name', don't yell too much, I'm new to python :)
r = requests.get('http://baskino.me/films/fantasticheskie/')
soup = BS(r.content, 'html.parser')
def fantasic_message(message):
items = soup.find_all('div', class_='shortpost')
movie = []
for item in items:
movie.append({
'Название': item.find('div', class_='posttitle').get_text(strip=True),
'Ссылка': item.find('a').get('href'),
'Рейтинг': item.find('li', class_='current-rating').get_text(),
'Дата': item.find('div', class_='rinline').get_text()
})
bot.send_message(message.chat.id, movie, parse_mode='html')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question