Pyrogram的download_media方法无法下载图片问题求助
Pyrogram的download_media方法无法下载图片问题求助
大家好,我最近在用Pyrogram写一个从Telegram消息里下载图片的简单函数,但遇到了棘手的问题:download_media方法完全下载不了图片,返回的file_path一直是None。
我能确认收到的message对象以及它的photo属性是包含有效数据的——打印出来的照片详情(比如文件ID、尺寸、大小这些)都正常,但下载操作就是没效果。我试过分别把message、m_photo还有file_id传给download_media,结果都没用。
下面是我的代码:
async def download_photo(message): m_photo = message.photo file_id = m_photo.file_id file_unique_id = m_photo.file_unique_id width = m_photo.width height = m_photo.height file_size = m_photo.file_size date = m_photo.date print(m_photo) print(f"Photo details - File ID: {file_id}, File Unique ID: {file_unique_id}, Width: {width}, Height: {height}, File Size: {file_size}, Date: {date}") file_path = await app.download_media(m_photo, file_name=f'{message.chat.id}_{file_unique_id}.jpg') return file_path asyncio.run(download_photo(message))
有没有大佬能帮我看看问题出在哪呀?
备注:内容来源于stack exchange,提问作者abdus_salam
相关产品推荐
相关产品推荐

