filippz / telegram_import

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

Unknown import format (caused by InitHistoryImportRequest) #10

Closed BakunawaPH closed 3 months ago

BakunawaPH commented 3 months ago

Hi, I'm very unfamiliar with Python (and coding in general) and the most I've been exposed to it is a few days ago when I started learning how to utilize your Repository due to a dire need of importing my old Telegram data. So long story short, I think I was able to run it correctly but since it was going too slow, I left the PC running to continue the uploading status while I was out for work. When I came back, it showed this:

Telegram is having internal issues TimeoutError: Timeout while fetching data (caused by InitHistoryImportRequest) Upload files mentioned in messages Uploading (File unavailable, please try again later): 44%|███████████████████████████████████████████████████▍ | 2756/6330 [1:23:55<45:05, 1.32it/s][WinError 2] The system cannot find the file specified: 'C:/Users/trist/Downloads/Telegram Desktop/ChatExport_2024-08-12/\(File unavailable, please try again later)' Uploading (File unavailable, please try again later): 44%|██████████████████████████████████████████████████▌ | 2756/6330 [1:23:55<1:48:49, 1.83s/it]

Now, being someone who doesn't have any idea what to do, I did what I thought was the most logical and just ran the old syntax I used. Now it showed me this:

C:\Users\trist\Downloads\telegram_import-master\telegram_import-master>python telegram_import.py --path "C:/Users/trist/Downloads/Telegram Desktop/ChatExport_2024-08-12/" --peer "+639173161058" Loading config.ini Loading result.json Converting format Staring import Traceback (most recent call last): File "C:\Users\trist\Downloads\telegram_import-master\telegram_import-master\telegram_import.py", line 249, in import_history( File "C:\Users\trist\Downloads\telegram_import-master\telegram_import-master\telegram_import.py", line 209, in import_history history_import = client(functions.messages.InitHistoryImportRequest( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\AppData\Local\Programs\Python\Python312\Lib\site-packages\telethon\sync.py", line 39, in syncified return loop.run_until_complete(coro) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\trist\AppData\Local\Programs\Python\Python312\Lib\site-packages\telethon\client\users.py", line 30, in call return await self._call(self._sender, request, ordered=ordered) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\trist\AppData\Local\Programs\Python\Python312\Lib\site-packages\telethon\client\users.py", line 87, in _call result = await future ^^^^^^^^^^^^ telethon.errors.rpcerrorlist.ImportFormatUnrecognizedError: Unknown import format (caused by InitHistoryImportRequest)

I tried it again and it just asked me to log-in once again. I did that, which started the import process again but the above errors showed up once more. Now I'm completely lost. I don't have the slightest clue on where to begin to fix this. If it's not too much, can I ask for some help regarding this? Thank you!

filippz commented 3 months ago

It seems to me that the backup you have is not complete - please take a look in your result.json file and see if you have (File unavailable, please try again later) somewhere inside it. That indicates that some files couldn't be downloaded from Telegram servers so you could retry backup once more and/or simply remove problematic messages from result.json

BakunawaPH commented 3 months ago

Wow it worked! Removing the whole section where (File unavailable, please try again later) was in result.json made the import process work again! Looks like it was from a message with an indication of "self_destruct_period_seconds": 7,. Thanks for your help. Hopefully nothing goes wrong and I'm able to import my messages.