Dineshkarthik / telegram_media_downloader

Download media files from a telegram conversation/chat/channel up to 2GiB per file
MIT License
2.17k stars 364 forks source link

This script deleted my account, #85

Closed 5536086 closed 3 years ago

5536086 commented 3 years ago

This script deleted my account, pyrogram.errors.exceptions.unauthorized_401.UserDeactivatedBan: [401 USER_DEACTIVATED_BAN]: The user has been deleted/deactivated (caused by "updates.GetState")

Dineshkarthik commented 3 years ago

Telegram media downloader doesn't have any code/functionality that deals with any type of user account editing or updating.

pyrogram.errors.exceptions.unauthorized_401.UserDeactivatedBan: [401 USER_DEACTIVATED_BAN]: The user has been deleted/deactivated (caused by "updates.GetState")

The above error message merely states that the script is not authorized to make any API calls to Telegram using the provided user credentials as the user is deleted/deactivated.

Once you recreated your user you can retry with the script and you can download files from telegram.

5536086 commented 3 years ago

I applied to the TG official to unblock my account, but all my information was lost. I tried the script again. No accident, my account was blocked again! I suspect that there is an operation that triggers the banning of the account in the script, please check, now my account has been banned twice in the same way!

Dineshkarthik commented 3 years ago

I can assure you that the script does nothing of that sort, can you make sure that the channel you are trying to access is not some copyright-infringing channel? make sure you are entering the correct password If you had a password enabled also clear any state files media_downloader.session or any files ending with .session.

Dineshkarthik commented 3 years ago

I applied to the TG official to unblock my account, but all my information was lost. I tried the script again. No accident, my account was blocked again! I suspect that there is an operation that triggers the banning of the account in the script, please check, now my account has been banned twice in the same way!

can you share the entire log? It will help me identify the problem. It will be better if you can use the issue template and share other required details.

5536086 commented 3 years ago

When I tried to start the script for the second time, my account was already empty. I manually added a TG channel and then executed the script to download. The result was still blocked. Therefore, there is no possibility that the illegal content will cause the account to be blocked. Sex, I’m just a little worried that maybe some code in the script will trigger the TG system protection mechanism

5536086 commented 3 years ago

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

Dineshkarthik commented 3 years ago

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

share the channel you are trying to download.

Dineshkarthik commented 3 years ago

Please share your config file except for the api_hash and api_id

5536086 commented 3 years ago

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

share the channel you are trying to download.

https://t.me/scjchannel

5536086 commented 3 years ago

this

Please share your config file except for the api_hash and api_id

this QQ20210331150012

Dineshkarthik commented 3 years ago

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

share the channel you are trying to download.

image

The channel is used to spread pornographic content and is banned/restricted by telegram.

5536086 commented 3 years ago

e and share other required details.

Now my account has been completely banned, and the official customer service has refused to reply to me, so I don’t have any log records.

share the channel you are trying to download.

image

The channel is used to spread pornographic content and is banned/restricted by telegram.

But this is not enough to cause me to be banned, because I can use the TG export function to export pictures

Dineshkarthik commented 3 years ago

I used the channel to run the script and my account is not deleted/deactivated.

Config:

api_hash: my-api-hash
api_id: my-api-id
chat_id: scjchannel
file_formats:
  audio:
  - all
  document:
  - all
  video:
  - all
ids_to_retry: []
last_read_message_id: 0
media_types:
- audio
- photo
- video
- document
- voice

Log:

Telegram Media Downloader v0.3.1, Copyright (C) 2019 Dineshkarthik <https://github.com/Dineshkarthik>
Licensed under the terms of the MIT License

INFO:media_downloader:Device: CPython 3.8.6 - Telegram Media Downloader 0.3.1
INFO:media_downloader:System: Darwin 20.3.0 (EN)
INFO:pyrogram.connection.connection:Connecting...
INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO
INFO:pyrogram.session.session:NetworkTask started
INFO:pyrogram.session.internals.msg_id:Time synced: 2021-03-31 07:04:50.192888 UTC
INFO:pyrogram.session.session:NextSaltTask started
INFO:pyrogram.session.session:Next salt in 15m 49s (2021-03-31 09:20:38)
INFO:pyrogram.session.session:Session initialized: Layer 117
INFO:pyrogram.session.session:Device: CPython 3.8.6 - Pyrogram 1.0.7
INFO:pyrogram.session.session:System: Darwin 20.3.0 (EN)
INFO:pyrogram.session.session:Session started
INFO:pyrogram.session.session:PingTask started
INFO:pyrogram.dispatcher:Started 12 HandlerTasks
INFO:pyrogram.syncer:Synced "media_downloader" in 7.75719 ms
INFO:pyrogram.syncer:Synced "media_downloader" in 8.3158 ms
INFO:pyrogram.dispatcher:Stopped 12 HandlerTasks
INFO:pyrogram.session.session:PingTask stopped
INFO:pyrogram.session.session:NextSaltTask stopped
INFO:pyrogram.connection.connection:Disconnected
INFO:pyrogram.session.session:NetworkTask stopped
INFO:pyrogram.session.session:Session stopped
INFO:media_downloader:Updated last read message_id to config file
Dineshkarthik commented 3 years ago

By any chance are you routing your traffic via a network that telegram might consider as a location that is not related to you and thus flag it as unauthorized access to prevent illegal access of your account?

5536086 commented 3 years ago

我使用该通道运行脚本,并且未删除/停用我的帐户。

配置:

api_hash: my-api-hash
api_id: my-api-id
chat_id: scjchannel
file_formats:
  audio:
  - all
  document:
  - all
  video:
  - all
ids_to_retry: []
last_read_message_id: 0
media_types:
- audio
- photo
- video
- document
- voice

日志:

Telegram Media Downloader v0.3.1, Copyright (C) 2019 Dineshkarthik <https://github.com/Dineshkarthik>
Licensed under the terms of the MIT License

INFO:media_downloader:Device: CPython 3.8.6 - Telegram Media Downloader 0.3.1
INFO:media_downloader:System: Darwin 20.3.0 (EN)
INFO:pyrogram.connection.connection:Connecting...
INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO
INFO:pyrogram.session.session:NetworkTask started
INFO:pyrogram.session.internals.msg_id:Time synced: 2021-03-31 07:04:50.192888 UTC
INFO:pyrogram.session.session:NextSaltTask started
INFO:pyrogram.session.session:Next salt in 15m 49s (2021-03-31 09:20:38)
INFO:pyrogram.session.session:Session initialized: Layer 117
INFO:pyrogram.session.session:Device: CPython 3.8.6 - Pyrogram 1.0.7
INFO:pyrogram.session.session:System: Darwin 20.3.0 (EN)
INFO:pyrogram.session.session:Session started
INFO:pyrogram.session.session:PingTask started
INFO:pyrogram.dispatcher:Started 12 HandlerTasks
INFO:pyrogram.syncer:Synced "media_downloader" in 7.75719 ms
INFO:pyrogram.syncer:Synced "media_downloader" in 8.3158 ms
INFO:pyrogram.dispatcher:Stopped 12 HandlerTasks
INFO:pyrogram.session.session:PingTask stopped
INFO:pyrogram.session.session:NextSaltTask stopped
INFO:pyrogram.connection.connection:Disconnected
INFO:pyrogram.session.session:NetworkTask stopped
INFO:pyrogram.session.session:Session stopped
INFO:media_downloader:Updated last read message_id to config file

Mine will also appear in these LOG messages, but the number will be blocked after a while

5536086 commented 3 years ago

By any chance are you routing your traffic via a network that telegram might consider as a location that is not related to you and thus flag it as unauthorized access to prevent illegal access of your account?

The problems I encountered made me very confused, hey

5536086 commented 3 years ago

I re-register a number and continue to try, do I need a TGbot?

5536086 commented 3 years ago

By any chance are you routing your traffic via a network that telegram might consider as a location that is not related to you and thus flag it as unauthorized access to prevent illegal access of your account?

Not surprisingly, my newly registered account was banned again

`INFO:media_downloader:Device: CPython 3.7.4 - Telegram Media Downloader 0.3.1 INFO:media_downloader:System: Windows 10 (EN) INFO:pyrogram.session.auth:Start creating a new auth key on DC2 INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC2 - IPv4 - TCPAbridgedO INFO:pyrogram.session.auth:Done auth key exchange: DhGenOk INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC2 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.internals.msg_id:Time synced: 2021-03-31 07:24:12.300442 UTC INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 60s (2021-03-31 16:09:11) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started Enter phone number or bot token: INFO:pyrogram.session.session:PingTask started +12676060239 Is "+12676060239" correct? (y/N): y INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:Session stopped INFO:pyrogram.session.auth:Start creating a new auth key on DC1 INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC1 - IPv4 - TCPAbridgedO INFO:pyrogram.session.auth:Done auth key exchange: DhGenOk INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC1 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 60s (2021-03-31 16:09:29) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started The confirmation code has been sent via Telegram app Enter confirmation code: 84569 INFO:pyrogram.dispatcher:Started 12 HandlerTasks INFO:pyrogram.syncer:Synced "media_downloader" in 104.167 ms INFO:pyrogram.session.auth:Start creating a new auth key on DC5 INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.auth:Done auth key exchange: DhGenOk INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 59s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 56s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 53s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 51s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 48s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 46s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:pyrogram.session.session:NetworkTask stopped INFO:pyrogram.session.session:PingTask stopped INFO:pyrogram.session.session:NextSaltTask stopped INFO:pyrogram.connection.connection:Disconnected INFO:pyrogram.session.session:Session stopped INFO:pyrogram.connection.connection:Connecting... INFO:pyrogram.connection.connection:Connected! Production DC5 - IPv4 - TCPAbridgedO INFO:pyrogram.session.session:NetworkTask started INFO:pyrogram.session.session:NextSaltTask started INFO:pyrogram.session.session:Next salt in 44m 44s (2021-03-31 16:09:45) INFO:pyrogram.session.session:Session initialized: Layer 117 INFO:pyrogram.session.session:Device: CPython 3.7.4 - Pyrogram 1.0.7 INFO:pyrogram.session.session:System: Windows 10 (EN) INFO:pyrogram.session.session:Session started INFO:pyrogram.session.session:PingTask started INFO:media_downloader:Media downloaded - E:\TG\telegram_media_downloader\photo\photo_2020-03-30_19-34-02_6945715820068768768.jpg INFO:pyrogram.syncer:Synced "media_downloader" in 101.043 ms INFO:pyrogram.syncer:Synced "mediadownloader" in 78.3057 ms INFO:pyrogram.client:{ "": "types.UpdatesTooLong" } INFO:media_downloader:Updated last read message_id to config file Traceback (most recent call last): File "media_downloader.py", line 362, in main() File "media_downloader.py", line 347, in main begin_import(config, pagination_limit=100) File "D:\Python37\lib\asyncio\base_events.py", line 579, in run_until_complete return future.result() File "media_downloader.py", line 312, in begin_import async for message in messages_iter: File "D:\Python37\lib\site-packages\pyrogram\methods\messages\iter_history.py", line 85, in iter_history reverse=reverse File "D:\Python37\lib\site-packages\pyrogram\methods\messages\get_history.py", line 99, in get_history sleep_threshold=60 File "D:\Python37\lib\site-packages\pyrogram\methods\advanced\send.py", line 81, in send else self.sleep_threshold) File "D:\Python37\lib\site-packages\pyrogram\session\session.py", line 441, in send return await self._send(data, timeout=timeout) File "D:\Python37\lib\site-packages\pyrogram\session\session.py", line 411, in _send RPCError.raise_it(result, type(data)) File "D:\Python37\lib\site-packages\pyrogram\errors\rpc_error.py", line 83, in raise_it is_unknown=False) pyrogram.errors.exceptions.unauthorized_401.UserDeactivatedBan: [401 USER_DEACTIVATED_BAN]: The user has been deleted/deactivated (caused by "messages.GetHistory")

E:\TG\telegram_media_downloader>`

Dineshkarthik commented 3 years ago

Which channel are you trying now?

5536086 commented 3 years ago

Which channel are you trying now?

Same channel, hey

5536086 commented 3 years ago

I changed a number and a different running environment. It seems that there is no problem for the time being, but what do the screenshots mean? Can't the data be fetched? Waited for a long time, but no data has been downloaded yet. QQ20210331150012

Dineshkarthik commented 3 years ago

I wanted to point out when I try to access the channel you mentioned above I get 0 messages. so I can't download anything from the channel but from your log, I can see there was a photo downloaded when you run it. Not sure why Telegram is not showing any messages to me. Did you try downloading any other channel preferably one which is not restricted for pornography or any other copy-right infringement?

I ran the downloader script to download media from a channel that has a lot of files - aedahamlibrary_noolakam, It ran for 1h 3m 29s and processed 6186 messages and downloaded 548 files and nothing broke and my account is not banned. I also attached the log file media_downloader.log for your reference.

5536086 commented 3 years ago

I wanted to point out when I try to access the channel you mentioned above I get 0 messages. so I can't download anything from the channel but from your log, I can see there was a photo downloaded when you run it. Not sure why Telegram is not showing any messages to me. Did you try downloading any other channel preferably one which is not restricted for pornography or any other copy-right infringement?

I ran the downloader script to download media from a channel that has a lot of files - aedahamlibrary_noolakam, It ran for 1h 3m 29s and processed 6186 messages and downloaded 548 files and nothing broke and my account is not banned. I also attached the log file media_downloader.log for your reference.

I mainly download the video, but I can’t grab it. I don’t know if it’s because the video is relatively large

Dineshkarthik commented 3 years ago

I changed a number and a different running environment. It seems that there is no problem for the time being, but what do the screenshots mean? Can't the data be fetched? Waited for a long time, but no data has been downloaded yet. QQ20210331150012

This means there is some message fetches and sync happening with the telegram in the background and also if download files are present the files are being downloaded in parallel and you will get an info message once the file is completed.

Dineshkarthik commented 3 years ago

I wanted to point out when I try to access the channel you mentioned above I get 0 messages. so I can't download anything from the channel but from your log, I can see there was a photo downloaded when you run it. Not sure why Telegram is not showing any messages to me. Did you try downloading any other channel preferably one which is not restricted for pornography or any other copy-right infringement? I ran the downloader script to download media from a channel that has a lot of files - aedahamlibrary_noolakam, It ran for 1h 3m 29s and processed 6186 messages and downloaded 548 files and nothing broke and my account is not banned. I also attached the log file media_downloader.log for your reference.

I mainly download the video, but I can’t grab it. I don’t know if it’s because the video is relatively large

yeah the sync message you mentioned earlier is also an indication that you are downloading some huge files.