skip to Main Content

According to Telegram docs:

Link Preview is generated server-side

I’m trying to make a bot to process the info in the link preview for links sent by users, but I couln’t find a way to get that information from the Bot API.

Is there any way to ask the API for the information the link preview shows?

2

Answers


  1. Chosen as BEST ANSWER

    Although there is no API method to get this information, Telegram uses the Open Graph Protocol to generate its Link Previews.

    Any open graph client will provide the same information that Telegram shows in their Link Previews.


  2. Is there any way to ask the API for the information the link preview shows?

    The answer would be no. The Bot API cannot process the information in the link preview.

    I’m trying to make a bot to process the info in the link preview for links sent by users

    However if you want the bot to know what is on the other side of the link, It is possible. You can use a HTML content scrapping library and a Summarizing library to get a link preview. I have attached below the libraries you can use and a Reddit bot which is somehow close to what you need. The example libraries are in python but you can essentially get or make for the language you use.

    python-goose is a HTML content scrapping library

    python summarizing library

    another python summarizing library

    sample reddit bot

    Telegram MessageEntity object

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search