filippz / telegram_import

Import back messages exported from Telegram into JSON format
14 stars 2 forks source link

File exceeds maximum size. Change data exporting settings to download #13

Open yoburtu opened 3 days ago

yoburtu commented 3 days ago

Hi,

I'm trying to import 2.5GB of data from a group chat to a Telegram phone number directly, as this peer wasn't giving me FloodWaitError issues.

But now I'm getting another error:

File exceeds maximum size. Change data exporting settings to download.

Is this a setting that needs to be made in config.ini or is it another error on Telegram's servers due to excess data?

Regards.

filippz commented 3 days ago

I'm sorry that you're still struggling with (group) import. If you're on fast network connection you might try lowering the speed or using some slower network as I would assume that FloodWaitError is tied to the size of data over a period of time. Another option is to split JSON to more than one file and try importing in "chunks".

As for the size error, this might be related to different types of chats/channels/groups and/or premium features. You could remove the messages with biggest attachments from JSON to test the theory.

yoburtu commented 2 days ago

Hi. I have tried to separate the import by years, but, for example, for a size of 40MB, the process fails.

I have no experience in Python programming and I cannot modify the script. Please, Could you modify the script so that the import is done element by element instead of trying to load the entire JSON file?.

I would really appreciate it. Thank you very much.

Best regards.

filippz commented 2 days ago

Hi. I have tried to separate the import by years, but, for example, for a size of 40MB, the process fails.

You should provide more info apart from "...the process fails".

I have no experience in Python programming and I cannot modify the script. Please, Could you modify the script so that the import is done element by element instead of trying to load the entire JSON file?.

If you're having trouble importing just as small number of messages then there is no point in implementing such changes. Anyway, you can can export to a couple of JSON files by setting the date range while exporting and try, but if it fails for just 40MB of messages/files then we have another issue altogether.

yoburtu commented 1 day ago

The error is related to FloodWaitError:

telethon.errors.rpcerrorlist.FloodWaitError: A wait of XXX seconds is required (caused by CheckChatInviteRequest).

But this error appears when I use the group invitation link as a peer. If I use the Telegram phone number peer, I am importing all the data. So, I will be doing this for years. Thank you very much for everything.

Best regards.

filippz commented 1 day ago

I've just pushed a version that can handle group ids (starting with -100) so you can try that one. Other than that, you could to check if you're a group admin, or you could make someone else the admin and try importing from that account. It might be that your account/group is under some kinds of restrictions...

yoburtu commented 18 hours ago

I have tested this version, but it doesn't work.

$ python3 telegram_import.py --path ChatExport_2024-09-20 --peer "-100XXXXXXXXX"
Loading config.iniChat
Loading result.json
Converting format
Traceback (most recent call last):
  File "telegram_import.py", line 256, in <module>
    import_history(
  File "telegram_import.py", line 205, in import_history
    client(functions.messages.CheckHistoryImportPeerRequest(
  File ".local/lib/python3.12/site-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File ".local/lib/python3.12/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".local/lib/python3.12/site-packages/telethon/client/users.py", line 87, in _call
    result = await future
             ^^^^^^^^^^^^
telethon.errors.rpcerrorlist.PreviousChatImportActiveWaitMinError: Similar to a flood wait, must wait 5 minutes (caused by CheckHistoryImportPeerRequest)