注:telegram 提供了相关的API,根据要求在相关网址上申请相关需要的参数,登录telegram就可以抓取telegram数据了,申请主要是点点点,所以这里省略
这里默认你拿到相关的参数信息,直接上代码
from telethon import TelegramClient, utils
from telethon.tl.types import InputMessagesFilterPhotos, InputMessagesFilterDocument
api_id = 1234567
api_hash = '75757892add13892757892add136e6a775789'
client = TelegramClient('Jian', api_id, api_hash)
channel = 'https://t.me/jeannieStudioGroup'
async def main():
# print('**********************send_message*****************************')
# # 发送消息
# await client.send_message('me', 'Hello to myself!')
print('*************************messages**************************')
messages = client.iter_messages(channel, limit=100)
msges = '';
async for message in messages:
msg = str(message.date) + '