Dineshkarthik/telegram_media_downloader

the client time has to be synchronized.

tapatianbeast opened this issue · 14 comments

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Share the config: Please don't share your api_hash & api_id

chat_id: telegram_chat_id
last_read_message_id: 0
media_types:
- audio
- photo
- video
- document
- voice
file_formats:
  audio:
  - all
  document:
  - all
  video:
  - all

Python Version
Python: [e.g. 3.9]

OS:
The OS and its version: [e.g. debian 11]

Logs
Traceback (most recent call last):
File "/home/hugo/media_downloader_telegram/media_downloader.py", line 376, in
main()
File "/home/hugo/media_downloader_telegram/media_downloader.py", line 360, in main
updated_config = asyncio.get_event_loop().run_until_complete(
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/hugo/media_downloader_telegram/media_downloader.py", line 311, in begin_import
await client.start()
File "/home/hugo/.local/lib/python3.9/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
is_authorized = await self.connect()
File "/home/hugo/.local/lib/python3.9/site-packages/pyrogram/methods/auth/connect.py", line 47, in connect
await self.session.start()
File "/home/hugo/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 142, in start
raise e
File "/home/hugo/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 109, in start
await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
File "/home/hugo/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 333, in send
raise BadMsgNotification(result.error_code)
pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.

Additional context
I got my server synced

Local time: Sun 2023-06-11 17:31:3…
Universal time: Mon 2023-06-12 00:31:3…
RTC time: Mon 2023-06-12 00:31:32
Time zone: America/*** (*** …
System clock synchroni… yes
NTP service: active
RTC in local TZ: no

I was able to get rid of the same error by updating the pyrogram but then you get a new error.

Traceback (most recent call last):
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 376, in
main()
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 360, in main
updated_config = asyncio.get_event_loop().run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 313, in begin_import
messages_iter = client.get_chat_history(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\sync.py", line 53, in async_to_sync_wrap
coroutine = function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GetChatHistory.get_chat_history() got an unexpected keyword argument 'reverse'

C:\Users\T\Desktop\telegram_media_downloader>

I also forgot to mention I Uninstalled pyrogram reinstalled using pip Install requirments and now I have the [16] The msg_id is too low, the client time has to be synchronized. error again

I was able to get rid of the same error by updating the pyrogram but then you get a new error.

Traceback (most recent call last):
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 376, in
main()
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 360, in main
updated_config = asyncio.get_event_loop().run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\T\Desktop\telegram_media_downloader\media_downloader.py", line 313, in begin_import
messages_iter = client.get_chat_history(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\sync.py", line 53, in async_to_sync_wrap
coroutine = function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GetChatHistory.get_chat_history() got an unexpected keyword argument 'reverse'

C:\Users\T\Desktop\telegram_media_downloader>

Looks like argument reverse is deprecated in this new version of pyrogram.

Some fix/fork who works?

@tapatianbeast deleting the media_downloader.session file worked for me

HyShai commented

@Dineshkarthik 's fork of pyrogram needs to be updated

@tapatianbeast deleting the media_downloader.session file worked for me

That's only work once

@Dineshkarthik 's fork of pyrogram needs to be updated

@HyShai hi, Which commit fix it?

HyShai commented

@Dineshkarthik 's fork of pyrogram needs to be updated

@HyShai hi, Which commit fix it?

Not sure, but the latest version of pyrogram works - I just needed to manually patch it with @Dineshkarthik's changes

@Dineshkarthik 's fork of pyrogram needs to be updated

@HyShai hi, Which commit fix it?

Not sure, but the latest version of pyrogram works - I just needed to manually patch it with @Dineshkarthik's changes

Thanks that works perfect

RANZ0 commented

@tapatianbeast @HyShai hi can you guys please explain how to fix this issue?
Im working on both windows 11 and ubuntu 23.04

@tapatianbeast @HyShai hi can you guys please explain how to fix this issue?
Im working on both windows 11 and ubuntu 23.04

1.Uninstall pyrogram
2.Install the latest version from pip
3. Go to pyrogram/methods/messages/ and delete get_chat_history.py
4. In the same directory do wget https://raw.githubusercontent.com/pyrogram/pyrogram/6966455d4a4d3981f1771271a60cbb3b57c2edbe/pyrogram/methods/messages/get_chat_history.py and its all

Updated the custom pyrogam fork this should fix the issue

pip uninstall pyrogram
pip install https://github.com/Dineshkarthik/pyrogram/archive/refs/heads/master.zip
RANZ0 commented

@tapatianbeast thanks a lot it worked for me .