M
M
Maxim2020-10-26 12:10:18
Android
Maxim, 2020-10-26 12:10:18

How to teach the bot to hide the link in the text and send it to the client?

Hello everyone, the bottom line is that you need to hide the links in the text ... since the parsed links turn out to be too large for output (they take up almost the entire screen). How can be implemented?

def get_Data(text):
    response = requests.get(HOST + 'site/ru')
    soup = BeautifulSoup(response.text,'lxml')
    try:
        text = soup.find('div', class_='main_left').find('tr').text.strip()
        return  text

    except:
        return 'Ошибка! '

       if message.text == 'anon':
     bot.send_message(message.chat.id,get_Data(message.text))


When anon is called, the link is parsed and sent to the user.
I googled, it seems they do it through markdownv2, but I tried it - nothing happened. Or am I doing something wrong, as I'm still new to this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nokhchi Borz, 2016-04-25
@CheeBorz

lmgtfy.com/?q=Not+allowed+to+load+local+resource+a...

A
Alexander, 2020-10-26
@wkes

Are you talking about it?

bot.send_message(chat_id, '<a href="https://qna.habr.com/q/871643">Как научить бота прятать в текст ссылку и отправлять клиенту?</a>', parse_mode='html')

5f969a2910599798913028.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question