Дамп медиа чата Telegram с помощью Telethon

Всем привет! Хочу сделать полный дамп нескольких чатов. Сначала хочу разобраться с медиа. Но с моим кодом скачивается только последние два года из шести. Выдают такую ошибку:

The file reference has expired and is no longer valid or it belongs to self-destructing media and cannot be resent (caused by GetFileRequest)

Не смог найти в гугле что это точно означает и как это исправить. Вот код:

def download_all(channels, client):
    for target in channels:
        try:
            print(f'Starting with {target.title}...')
            for msg in tqdm(client.get_messages(target, None)):
                try:
                    msg.download_media(f".//{target.title}-{date.today()}//")
                except Exception as e:
                    print(f"Smth goes wrong: {e}")
                    continue
        except Exception as e:
            print(f"Smth goes wrong: {e} \ntrying another target")
            continue
        else:
            print('\nDone!')

Ответы (0 шт):