使用 TQDM 的 Telegram Telethon 媒体下载进度

问题描述

在使用 Telethon 下载时,我只想要一个工作进度条 (tqdm)。

def prog(current,total):
    global pbar
    pbar.update(current)

pbar = tqdm()

async def DoIt():
    global pbar
    async for message in client.iter_messages(entity=entity,limit=60,reverse=False):
        pbar = tqdm(unit='B',unit_scale=True,total=message.media.document.size)
        await client.download_media(message.media.document,"Q:\\dl",progress_callback=prog)
        pbar.close()

这真的行不通。进度条从“0”变为“100”:

pbar

然后出现:

pbar

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)