Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

MediaEmptyError when trying to upload an album of videos

Open the-blank-x opened this issue 2 years ago • 1 comments

Checklist

  • [X] The error is in the library's code, and not in my own.
  • [X] I have searched for this issue before posting it and there isn't a duplicate.
  • [X] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.

Code that causes the issue

import asyncio
from telethon import TelegramClient

async def main():
    client = TelegramClient('Download/general-sync/keys/knees', 1, '!')
    await client.start()
    await client.send_file('me', ['bargin-day.mp4', 'Oyasumi-r8ppxy_000.mp4'])

asyncio.run(main())

Traceback

Traceback (most recent call last):
  File "/storage/emulated/0/t.py", line 9, in <module>
    asyncio.run(main())
  File "/data/data/com.termux/files/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/data/data/com.termux/files/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/storage/emulated/0/t.py", line 7, in main
    await client.send_file('me', ['bargin-day.mp4', 'Oyasumi-r8ppxy_000.mp4'])
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/telethon/client/uploads.py", line 362, in send_file
    result += await self._send_album(
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/telethon/client/uploads.py", line 480, in _send_album
    result = await self(request)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.MediaEmptyError: The provided media object is invalid or the current account may not be able to send it (such as games as users) (caused by SendMultiMediaRequest)

the-blank-x avatar Dec 04 '21 17:12 the-blank-x

One of the files didn't have an audio stream, InputMediaUploadedDocument.nosound_video needs to be True. TDesktop simply sets it to True if the file is in an album

the-blank-x avatar Dec 04 '21 17:12 the-blank-x

Closing under the assumption this works in the current git version. If that's not the case, let me know and we can reopen it.

Lonami avatar Apr 06 '23 12:04 Lonami