使用telethon python刮取当前文件和图像

2024-06-13 08:28:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我在telethon中使用了一个python代码,它只从电报频道的消息中提取文本

def scraping_messages_from_channel(target_channel):
   messages = []
   for message in client.iter_messages(target_channel):
       messages.append(message.text)
   return messages

我想从电报频道中抓取更新的或者说当前的消息,如果消息由文件和文本组成,那么脚本会同时抓取这两个

有没有办法完成这项任务

谢谢


Tags: 代码infrom文本消息messagetargetfor