C
C
Captain Cocoa2021-03-11 14:10:48
API
Captain Cocoa, 2021-03-11 14:10:48

How to get a list of all posts from my Telegram channel?

There is a channel with posts (image + description + hashtags)
I want to sketch a pwa application and display a list of posts from the cart in it.
Is it possible to do this using the telegram API?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Golovanenko, 2021-03-11
@drygdryg

Look towards Python + Telethon (MT-proto API): https://telethonn.readthedocs.io/en/latest/extra/b...
Most likely, you can read channel messages in some of the ways described in this guide.
One example from this tutorial that I think can be applied to reading messages from a channel:

# Retrieving messages from a chat
from telethon import utils
for message in client.get_message_history('username', limit=10):
    print(utils.get_display_name(message.sender), message.message)

Another option, I think, would be to receive messages as updates immediately after they are sent to the channel via the Bot API (you need to add your bot as an administrator to the channel). To do this, see the getUpdates Bot API method: https://core.telegram.org/bots/api#getupdates

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question