skip to Main Content

I want to get a message’s views but I don’t know which method should I use.
Here is the telegram API. I have the channel ID and the message_id,(I got them from my telegram bot). I know that telegram bot API doesn’t have access to views so I want to use the main telegram API but I don’t know which method should I use.

2

Answers


  1. you can follow this steps:

    example: https://t.me/tehrandb/93

    • open the link with PHP or Python or other languages

    exammple

    • Extract the field value with the ‍‍tgme_widget_message_views class
    Login or Signup to reply.
  2. by python and telethon you can access to a certain message
    and that message object have an attribute ‘view’:

    m = Message(id=4864, to_id=PeerUser(user_id=818906659), date=datetime.datetime(2019, 6, 25, 4, 47, 57, tzinfo=datetime.timezone.utc), message=':reminder_ribbon:تک فیلم آموزش پروژه محور n:man:u200d:computer:پیاده سازی  Responsive Menu n:point_left: 0 تا 100n:round_pushpin:با css & htmln#webn@stepbysteplearn', out=False, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, from_id=818906659, fwd_from=MessageFwdHeader(date=datetime.datetime(2019, 6, 24, 20, 29, 53, tzinfo=datetime.timezone.utc), from_id=None, from_name=None, channel_id=1023032463, channel_post=11711, post_author=None, saved_from_peer=PeerChannel(channel_id=1023032463), saved_from_msg_id=11711), via_bot_id=None, reply_to_msg_id=None, media=MessageMediaDocument(document=Document(id=5803386688260540004, access_hash=5193338638774407914, file_reference=b'x01x00x00x13x00]x18l:xb7xd5r&xe8xb5jxa65*xeax01xdcxe2Py', date=datetime.datetime(2019, 6, 24, 20, 29, 52, tzinfo=datetime.timezone.utc), mime_type='video/mp4', size=16955767, dc_id=4, attributes=[DocumentAttributeVideo(duration=668, w=1280, h=720, round_message=False, supports_streaming=True), DocumentAttributeFilename(file_name='Responsive_Menu_With_Media_Queries.mp4')], thumbs=[PhotoStrippedSize(type='i', bytes=b'x01x16(xc5xa2x8a(x00xa2x8a(x00xa2x8a(x00xa2x8a(x00xa2x8a(x00xa2x8a(x03'), PhotoSize(type='m', location=FileLocationToBeDeprecated(volume_id=455132553, local_id=24511), w=320, h=180, size=644)]), ttl_seconds=None), reply_markup=None, entities=[MessageEntityHashtag(offset=90, length=4), MessageEntityMention(offset=95, length=16)], views=6276, edit_date=None, post_author=None, grouped_id=None)
    

    m.views will return a specific message views

    full information of a message object in telegram.

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