是否可以通过Telethon从消息中下载多张照片?

时间:2020-05-14 12:37:40

标签: python telegram telethon

我正在尝试使用以下代码从邮件中下载几张照片:

client.start()
messages = client.get_messages('https://t.me/*****', 10)
client.download_media(messages[1])

问题是-我从每封邮件中只得到第一张照片。 我尝试打印得到的消息对象:

Message(id=**, to_id=PeerChannel(channel_id=*), date=datetime.datetime(2020, 5, 12, 19, 1, 7, tzinfo=datetime.timezone.utc), message='', out=False, mentioned=False, media_unread=False, silent=False, post=True, from_scheduled=False, legacy=False, edit_hide=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to_msg_id=None, media=MessageMediaPhoto(photo=Photo(id=53214**28130833795, access_hash=1933**8736, file_reference=b'\x02O@\xb8|\x00\x00\x00\xa6^****bb\x1d6/\x89\x02$\xe6\xe2\xa4\xdd/', date=datetime.datetime(2020, 5, 12, 19, 1, 7, tzinfo=datetime.timezone.utc), sizes=[PhotoStrippedSize(type='i', bytes=b'\x01((\xba$\x1e\x86\x86\x90c\xa1\xa6\xe0c\x1bx\xa6`\x83\x83\x8d\xa3\xa6(\x01\xfeb\x8e\xb9\xa7y\xa9\xef\xf9T\x05~`Oj\t\x00\x93\xd6\x80$.3\x*\x15\x08t\x19\x18n}\xe8\xa6\x05\xac\x00*\x13\x9d\xd53\x8f\x94\xe2\x99\xd4\x02z\xe2\xa5\x8c\x8c\xe0\xaf\xbd4\x8crri\xc7\xd0Rg\x1c\xf7\xa4\x03Tr3\xde\x8aX\xfeg\xcfj*\x90\x16I\xe6\x9a\xc3\xd2\x8a(\x10\xc2\xb8\xedI\xb3w^3\xd7\x14QHc\x95UzQE\x14\xc4\x7f'), PhotoSize(type='m', location=FileLocationToBeDeprecated(volume_id=2000*00783, local_id=1*66), w=280, h=280, size=14705)], dc_id=2, has_stickers=False), ttl_seconds=None), reply_markup=None, entities=[], views=37, edit_date=None, post_author=None, grouped_id=12714*541116570, restriction_reason=[])

,看来我需要获取媒体中的照片列表,而不是单张照片。 难道我做错了什么? 如何从一条消息中下载多张照片?

0 个答案:

没有答案