简体   繁体   中英

How to scrape smiles from a messages in telegram channel with telethon

I scrape messages from a telegram channel with telethon

with TelegramClient('session_name', api_id, api_hash) as client:
   for message in client.iter_messages(chat):
      print(message.sender_id, ':', message.text)

and i have a problem with scrape interactive smiles from a messages, how i get to fix it?

Screenshot: in a empty spaces should have been a interactive smiles from telegram

()

I need this smile to scrape Interactive Dice Smile

There is in telethon type 'InputMediaDice' with it you can catch all interactive emoticons

with TelegramClient('session_name', api_id, api_hash) as client:
   for message in client.iter_messages(channel_link, reply_to = post_num, filter = InputMediaDice('🎲')):
       if type(message.media) == MessageMediaDice and message.media.emoticon == '🎲' and message.media.value == 5:
           print(message.media.emoticon)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM