3bl3gamer / tg_history_dumper

Exports messages and media from Telegram dialogs, groups and channels
MIT License
69 stars 13 forks source link

Can't run go command to get the repo. #13

Closed zydjohnHotmail closed 2 years ago

zydjohnHotmail commented 2 years ago

Hello: I am totally newbie for GO, I just played it for 5 minutes. Anyway, I want to install your repo, but I got the following error: C:\Telegram\Go_Projects>go get github.com/3bl3gamer/tg-history-dumper go: go.mod file not found in current directory or any parent directory. 'go get' is no longer supported outside a module. To build and install a command, use 'go install' with a version, like 'go install example.com/cmd@latest' For more information, see https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'.

C:\Telegram\Go_Projects> If it is not the issue for the repo, but at least tell me how I can download and install the repo. Can I download the code as zip file and unzip it in my PC (Windows 10). By the way, if I want to use the repo to export some public channel chats, how I can write the json format file. Here is the details: For example, I have joined about 20 Telegram public channels. I want to export channel chats for 2 of the 20 channels. In Telegram desktop for Windows, I can do it by hand, but I want to know if I can use your repo to do this by GO script. From Telegram desktop, when I want to export channel chats, I have to set the following parameters: 1) Type of messages: I want to include: Photos, Videos, Video messages, Files. 2) Size limit: default is 8MB, which is too small, I want to increase it to 100MB. 3) Format: default is HTML, but I want to change it to Json 4) Path: default is C:\Downloads\Telegram Desktop …, I want to change it to something like: D:\Telegram\Export\Channel. 5) From time, the default is the oldest message, I want to change it to from yesterday's message. 6) To time, it is OK to set it to present. Therefore, I have to provide 6 parameters (the type of messages, there are 3 more items to set) before I can run export one channel chats. Please give me an example how to use your repo to export one public channel chats using the above 6 parameters. Thank you very much,

3bl3gamer commented 2 years ago

I want to install your repo, but I got the following error

Oops, I haven't tested this installation method for a looong time... Thanks for pointing out the problem :)

Currently it should be: go install github.com/3bl3gamer/tg_history_dumper@latest. If the Windows Go installer has done everything right, you then will be able to run tg_history_dumper from any folder. Otherwise, you will have to use the full path to the executable (perhaps C:\Users\<user>\go\bin\tg_history_dumper).

You can also download the code as zip and run go build inside the unzipped folder. That way you will get the tg_history_dumper executable in current (unpacked) folder.

set the following parameters

The Dumper is configured via config.json. Almost everything is optional here so you may start with just {"app_id":..., "app_hash":"..."} and needed parameters. The config file will be picked automatically if it is in the current directory. Otherwise you can specify custom path: tg_history_dumper -config pat\to\config.json.

  1. Message filtering is currently not supported. Dumper can only get sequential messages with (optionally) related media. Media can be filtered by size though.
  2. "media": {"media_max_size": "100M"} in the config, more info here.
  3. JSON is the only format currently supported by Dumper (though it is different from Telegram's JSON).
  4. "out_dir_path": "D:\Telegram\Export\" in the config, more info here.
  5. Time filtering is currently not supported. Though it is possible to get N last messages with "history_limit": {"100": "all"} in the config, more info here.
zydjohnHotmail commented 2 years ago

Hello: Thanks for your reply and modify README. Now, I can install the repo in my PC. However, I don’t know how to configure the json file to use the repo. The following is the config.json I can write now:

{ "app_id": 1234567, "app_hash": "XXXXXXXXXXXXXXXXXX", "request_interval_ms": 1000, "session_file_path": "tg.session", "out_dir_path": "C:\Telegram\Export\Go_Dump\", "history": [ {"title": "TheGroup"} ], "media": [ {"title": "TheGroup", "media_max_size": "2000M"} ], "history_limit": { "5000": [ "all" ] }, "dump_account": "off", "dump_contacts": "off", "dump_sessions": "off" }

I have questions about the history and media. For a public channel, I can use IDBot to find some information about the channel I want to export. But in the config.json, "history": [ {"title": "TheGroup"} ], What is the title value for the public channel: is it the name on Telegram with @ at beginning, like: @Channel_Name1? Or, I can see the Channel ID, it is a big negative number, like: id: -1001488840532

The same for media, "media": [ {"title": "TheGroup", "media_max_size": "2000M"} ], How I can fill the value for “title”? Please provide some examples. Thanks,

3bl3gamer commented 2 years ago

What is the title value for the public channel

"title" is the title displayed in the UI. You can also filter by {"username": "the_group"} (text after the @) or by {"id": 12345} (though it should be positive number, likely without leading "-100"). More info here.

You can list all chats ids, names and titles by running the dumper with -list-chats argument.

zydjohnHotmail commented 2 years ago

Hello: I think I know how to make a working config file, but when I run the dumper command, I got error:

F:\Telegram\Export\Go_Dump>tg_history_dumper 2022/06/27 09:08:14 [INFO] connecting to DC 0 (149.154.167.50:443)... 2022/06/27 09:08:16 [INFO] connected to DC 2 (149.154.167.50:443)... Enter phone number: 001234567890 (Here is a fake number, but when I run it, I used my number) 2022/06/27 09:08:30 [INFO] reconnecting: DC 2 -> 4 2022/06/27 09:08:30 [INFO] connecting to DC 4 (149.154.167.92:443)... 2022/06/27 09:08:32 [INFO] connected to DC 4 (149.154.167.92:443)... 2022/06/27 09:08:32 [INFO] reconnected to DC 4 (149.154.167.92:443) Enter code: 2022/06/27 09:08:32 [ERROR] : RPC: mtproto.TL_bad_msg_notification{BadMsgID:7113813225187514352, BadMsgSeqno:25, ErrorCode:33}

github.com/3bl3gamer/tgclient/mtproto.(MTProto).Auth C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tgclient@v0.143.0/mtproto/mtproto.go:697 github.com/3bl3gamer/tgclient.(TGClient).AuthExt C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tgclient@v0.143.0/tgclient.go:144 main.tgConnect C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/tg.go:103 main.dump C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/main.go:279 main.main C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/main.go:381 runtime.main C:/Program Files/Go/src/runtime/proc.go:250 runtime.goexit C:/Program Files/Go/src/runtime/asm_amd64.s:1571

F:\Telegram\Export\Go_Dump>

The issue is: it will take a few seconds until I got the verification code from Telegram service notifications, but before I received the verification code, the program already shows error and quits. See the above output from the program. You can see the time between 2 log entries: 2022/06/27 09:08:32 [INFO] reconnected to DC 4 (149.154.167.92:443) Enter code: 2022/06/27 09:08:32 [ERROR] :

By the way, I seems to find the reason why I got the above error, from my Telegram bot web page, I saw the following information: Available MTProto servers Test configuration: 149.154.167.40:443

Production configuration: 149.154.167.50:443

But in the program, it used different MTProto IP: (149.154.167.92:443) when reconnecting: DC 2 -> 4. If it still uses (149.154.167.50:443), it should work, but it uses another IP (149.154.167.92:443), which is not server for my bot, then authentication fails. Is it possible that I can assign MTProto IP in the config.json file, so the program picks it up from config.json? Thanks,

3bl3gamer commented 2 years ago

This error happened only once? Or does it happen every time you try to connect? I rarely got similar error, but it was usually gone after a restart.

If it still uses (149.154.167.50:443), it should work

It reconnected to DC4 because DC2 asked the client to do so. So if 149.154.167.50 will be used again, it will likely reconnect again.

But 149.154.167.50 is a default, so you can remove the session file (tg.session) and try to connect again.

zydjohnHotmail commented 2 years ago

Hello: I did delete the session file (tg.session) and try again, I got the same error. I tried 3 times, with the same error. So I didn't try the 4th time, I think I will get banned or flood wait, etc. But I can try it tomorrow. However, let me know if you can keep the program using 149.154.167.50, then it should be OK at least for my bot. Please advise,

3bl3gamer commented 2 years ago

I tried 3 times

Have you tried restarting without removing the tg.session file?

if you can keep the program using 149.154.167.50

I can't. Client asks TG to send the code via DC2, TG refuses to do so and asks Client to go to DC4. DC4 then sends the code.

There is a chance that it will fork if client will connect to DC4 from the start. I'll try to add this option if reconnection (without session removal) will not help.

Can you please also start the dumper with -debug-tg flag next time? It will show which API messages are being sent and received.

zydjohnHotmail commented 2 years ago

Here you go, I tried this time without deleting tg.session and add debug option: F:\Telegram\Export\Go_Dump>tg_history_dumper -debug-tg 2022/06/27 22:17:35 [INFO] connecting to DC 4 (149.154.167.92:443)... 2022/06/27 22:17:35 [DEBUG] connecting: getting config... 2022/06/27 22:17:35 [DEBUG] <<< TL_invokeWithLayer (#7114016562366008280) 2022/06/27 22:17:35 [DEBUG] >>> TL_bad_server_salt 2022/06/27 22:17:35 [DEBUG] popped 1 pending packet(s): []mtproto.TL{mtproto.TL_invokeWithLayer{Layer:143, Query:mtproto.TL_initConnection{Flags:0, ApiID:13460037, DeviceModel:"Unknown", SystemVersion:"windows/amd64", AppVersion:"0.0.1", SystemLangCode:"en", LangPack:"", LangCode:"en", Proxy:mtproto.TL(nil), Params:mtproto.TL(nil), Query:mtproto.TL_help_getConfig{}}}} 2022/06/27 22:17:35 [DEBUG] pushed 1 pending packet(s) 2022/06/27 22:17:35 [DEBUG] direct send: waiting for next packet 2022/06/27 22:17:35 [DEBUG] direct send: sending: &mtproto.packetToSend{msgID:7114016562366008280, seqNo:1, msg:mtproto.TL_invokeWithLayer{Layer:143, Query:mtproto.TL_initConnection{Flags:0, ApiID:13460037, DeviceModel:"Unknown", SystemVersion:"windows/amd64", AppVersion:"0.0.1", SystemLangCode:"en", LangPack:"", LangCode:"en", Proxy:mtproto.TL(nil), Params:mtproto.TL(nil), Query:mtproto.TL_help_getConfig{}}}, resp:(chan mtproto.TL)(0xc000156420), needAck:true} 2022/06/27 22:17:35 [DEBUG] <<< TL_invokeWithLayer (#7114016562366008280) 2022/06/27 22:17:35 [DEBUG] >>> TL_msg_container -> [TL_MT_message, TL_MT_message] 2022/06/27 22:17:35 [DEBUG] direct send: waiting for next packet 2022/06/27 22:17:35 [DEBUG] direct send: sending: &mtproto.packetToSend{msgID:0, seqNo:0, msg:mtproto.TL_msgs_ack{MsgIds:[]int64{7114016555985289217}}, resp:(chan mtproto.TL)(nil), needAck:false} 2022/06/27 22:17:35 [DEBUG] <<< TL_msgs_ack (#7114016562509111680) 2022/06/27 22:17:35 [DEBUG] >>> TL_rpc_result -> TL_config 2022/06/27 22:17:35 [DEBUG] direct send: sending: &mtproto.packetToSend{msgID:0, seqNo:0, msg:mtproto.TL_msgs_ack{MsgIds:[]int64{7114016556019951617}}, resp:(chan mtproto.TL)(nil), needAck:false} 2022/06/27 22:17:35 [DEBUG] <<< TL_msgs_ack (#7114016562521771980) 2022/06/27 22:17:35 [DEBUG] direct send: done 2022/06/27 22:17:35 [DEBUG] connecting: starting routines... 2022/06/27 22:17:35 [INFO] connected to DC 4 (149.154.167.92:443)... 2022/06/27 22:17:35 [DEBUG] <<< TL_users_getUsers (#7114016562532142580) 2022/06/27 22:17:35 [DEBUG] >>> TL_rpc_result -> TL_rpc_error 2022/06/27 22:17:35 Enter phone number: [DEBUG] <<< TL_msgs_ack (#7114016562590506080) 2022/06/27 22:17:40 [DEBUG] msgsByID: 0 total 2022/06/27 22:17:45 [DEBUG] msgsByID: 0 total 2022/06/27 22:17:50 [DEBUG] msgsByID: 0 total 2022/06/27 22:17:55 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:00 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:05 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:10 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:16 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:21 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:26 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:31 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:35 [DEBUG] <<< TL_ping (#7114016820230025340) 2022/06/27 22:18:35 [DEBUG] >>> TL_pong 2022/06/27 22:18:36 [DEBUG] msgsByID: 0 total 2022/06/27 22:18:41 [DEBUG] msgsByID: 0 total 001234567890 2022/06/27 22:18:44 [DEBUG] <<< TL_auth_sendCode (#7114016858671148304) 2022/06/27 22:18:44 [DEBUG] >>> TL_rpc_result -> TL_auth_sentCode Enter code: 2022/06/27 22:18:44 [DEBUG] <<< TL_msgs_ack (#7114016858799300804) 2022/06/27 22:18:44 [DEBUG] <<< TL_auth_signIn (#7114016858801957204) 2022/06/27 22:18:44 [DEBUG] >>> TL_rpc_result -> TL_rpc_error 2022/06/27 22:18:44 [DEBUG] <<< TL_msgs_ack (#7114016858867094704) 2022/06/27 22:18:44 [ERROR] : RPC: mtproto.TL_rpc_error{ErrorCode:400, ErrorMessage:"PHONE_CODE_EMPTY"}

github.com/3bl3gamer/tgclient/mtproto.(MTProto).Auth C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tgclient@v0.143.0/mtproto/mtproto.go:697 github.com/3bl3gamer/tgclient.(TGClient).AuthExt C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tgclient@v0.143.0/tgclient.go:144 main.tgConnect C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/tg.go:103 main.dump C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/main.go:279 main.main C:/Users/John/go/pkg/mod/github.com/3bl3gamer/tg_history_dumper@v0.0.0-20220626182356-9667d2a0f693/main.go:381 runtime.main C:/Program Files/Go/src/runtime/proc.go:250 runtime.goexit C:/Program Files/Go/src/runtime/asm_amd64.s:1571

F:\Telegram\Export\Go_Dump>

3bl3gamer commented 2 years ago

TL_rpc_error PHONE_CODE_EMPTY

It's not TL_bad_msg_notification now. So it worked, but you entered an empty confirmation code?

zydjohnHotmail commented 2 years ago

No. You didn't see the whole progress of the command running. After I entered my phone number, it will take a few seconds to get the verification code from Telegram desktop channel, so I have to wait until I found the verification code, then I can input the verification code in the program. However, the time after I entered the phone number until the time program exit with error code, the time is nearly 0, I have no time to enter the verification code, since it will need a few seconds to appear in Windows screen.
Hope you understand. I used another program (C#) WTelegramClient, this program will give you enough time to enter the verification code. The program holds the execution until you input verification code, then it continues to run. But this go program didn't hold the execution, it continues to run without waiting for verification code. However, I think the main reason is the program is using different IP address than the IP I got for my bot: (149.154.167.92:443) In my test configuration: 149.154.167.40:443

In my production configuration: 149.154.167.50:443

3bl3gamer commented 2 years ago

the time is nearly 0

Ok, now I looked closely on timestamps and I agree.

Turns out, there was a bug with scanning input on Windows (where Enter produces two characters: \r and \n). So it read phone number +12345\r\n until \r, \n remained unread. When it came to the confirmation code, it just read that remaining \n and returned empty string.

Fixed that, you can try one more time (but don't forget update the binary: go install github.com/3bl3gamer/tg_history_dumper@latest).

zydjohnHotmail commented 2 years ago

Hello: Thanks for finding the issue. I have a small question: do I have to uninstall the previous version, if yes, what command I can run. Like in Python: pip uninstall package. Please advise, Thanks,

zydjohnHotmail commented 2 years ago

Hello: I am almost there, here is the debug log after updating the repo:

F:\Telegram\Export\Go_Dump>tg_history_dumper -debug-tg 2022/06/28 23:08:04 [INFO] connecting to DC 0 (149.154.167.50:443)... 2022/06/28 23:08:04 [DEBUG] <<< TL_req_pq (#7114400656897956764) 2022/06/28 23:08:04 [DEBUG] >>> TL_resPQ 2022/06/28 23:08:05 [DEBUG] <<< TL_req_DH_params (#7114400660631622460) 2022/06/28 23:08:05 [DEBUG] >>> TL_server_DH_params_ok 2022/06/28 23:08:05 [DEBUG] <<< TL_set_client_DH_params (#7114400661265144860) 2022/06/28 23:08:05 [DEBUG] >>> TL_dh_gen_ok 2022/06/28 23:08:05 [DEBUG] connecting: getting config... 2022/06/28 23:08:05 [DEBUG] <<< TL_invokeWithLayer (#7114400661514440560) 2022/06/28 23:08:06 [DEBUG] >>> TL_msg_container -> [TL_MT_message, TL_MT_message] 2022/06/28 23:08:06 [DEBUG] direct send: waiting for next packet 2022/06/28 23:08:06 [DEBUG] direct send: sending: &mtproto.packetToSend{msgID:0, seqNo:0, msg:mtproto.TL_msgs_ack{MsgIds:[]int64{7114400659747003393}}, resp:(chan mtproto.TL)(nil), needAck:false} 2022/06/28 23:08:06 [DEBUG] >>> TL_rpc_result -> TL_config 2022/06/28 23:08:06 [DEBUG] <<< TL_msgs_ack (#7114400664855457156) 2022/06/28 23:08:06 [DEBUG] direct send: done 2022/06/28 23:08:06 [DEBUG] connecting: starting routines... 2022/06/28 23:08:06 [INFO] connected to DC 2 (149.154.167.50:443)... 2022/06/28 23:08:06 [DEBUG] <<< TL_msgs_ack (#7114400664863370156) 2022/06/28 23:08:06 [DEBUG] <<< TL_users_getUsers (#7114400664866487656) 2022/06/28 23:08:06 [DEBUG] >>> TL_rpc_result -> TL_rpc_error Enter phone number: 2022/06/28 23:08:06 [DEBUG] <<< TL_msgs_ack (#7114400664909362156) 2022/06/28 23:08:11 [DEBUG] msgsByID: 0 total 2022/06/28 23:08:16 [DEBUG] msgsByID: 0 total 001234567890 2022/06/28 23:08:20 [DEBUG] <<< TL_auth_sendCode (#7114400725163713900) 2022/06/28 23:08:20 [DEBUG] >>> TL_rpc_result -> TL_rpc_error 2022/06/28 23:08:20 [DEBUG] <<< TL_msgs_ack (#7114400725209469400) 2022/06/28 23:08:20 [INFO] reconnecting: DC 2 -> 4 2022/06/28 23:08:20 [DEBUG] stopping routines... 2022/06/28 23:08:20 [DEBUG] debugRoutine done 2022/06/28 23:08:20 [DEBUG] queueTransferRoutine done 2022/06/28 23:08:20 [DEBUG] sendRoutine done 2022/06/28 23:08:20 [DEBUG] pingRoutine done 2022/06/28 23:08:20 [DEBUG] waiting for routines... 2022/06/28 23:08:20 [DEBUG] readRoutine done 2022/06/28 23:08:20 [DEBUG] done stopping routines... 2022/06/28 23:08:20 [DEBUG] found 0 pending packet(s) 2022/06/28 23:08:20 [INFO] connecting to DC 4 (149.154.167.92:443)... 2022/06/28 23:08:20 [DEBUG] <<< TL_req_pq (#7114400725266245000) 2022/06/28 23:08:20 [DEBUG] >>> TL_resPQ 2022/06/28 23:08:21 [DEBUG] <<< TL_req_DH_params (#7114400730014484796) 2022/06/28 23:08:22 [DEBUG] >>> TL_server_DH_params_ok 2022/06/28 23:08:22 [DEBUG] <<< TL_set_client_DH_params (#7114400733784622892) 2022/06/28 23:08:22 [DEBUG] >>> TL_dh_gen_ok 2022/06/28 23:08:22 [DEBUG] connecting: getting config... 2022/06/28 23:08:22 [DEBUG] <<< TL_invokeWithLayer (#7114400734037542192) 2022/06/28 23:08:22 [DEBUG] >>> TL_msg_container -> [TL_MT_message, TL_MT_message] 2022/06/28 23:08:22 [DEBUG] direct send: waiting for next packet 2022/06/28 23:08:22 [DEBUG] direct send: sending: &mtproto.packetToSend{msgID:0, seqNo:0, msg:mtproto.TL_msgs_ack{MsgIds:[]int64{7114400730645203969}}, resp:(chan mtproto.TL)(nil), needAck:false} 2022/06/28 23:08:22 [DEBUG] >>> TL_rpc_result -> TL_config 2022/06/28 23:08:22 [DEBUG] <<< TL_msgs_ack (#7114400734088728292) 2022/06/28 23:08:22 [DEBUG] direct send: done 2022/06/28 23:08:22 [DEBUG] connecting: starting routines... 2022/06/28 23:08:22 [INFO] connected to DC 4 (149.154.167.92:443)... 2022/06/28 23:08:22 [DEBUG] <<< TL_msgs_ack (#7114400734095072392) 2022/06/28 23:08:22 [INFO] reconnected to DC 4 (149.154.167.92:443) 2022/06/28 23:08:22 [DEBUG] <<< TL_auth_sendCode (#7114400734099812592) 2022/06/28 23:08:22 [DEBUG] >>> TL_rpc_result -> TL_auth_sentCode Enter code: 2022/06/28 23:08:22 [DEBUG] <<< TL_msgs_ack (#7114400734200826092) 27022/06/28 23:08:27 [DEBUG] msgsByID: 0 total 62022/06/28 23:08:33 [DEBUG] msgsByID: 0 total 3772022/06/28 23:08:38 [DEBUG] msgsByID: 0 total 2022/06/28 23:08:39 [DEBUG] <<< TL_auth_signIn (#7114400806615698124) 2022/06/28 23:08:39 [DEBUG] >>> TL_rpc_result -> TL_auth_authorization Signed in: id 5459985716 name 2022/06/28 23:08:39 [DEBUG] <<< TL_msgs_ack (#7114400806704919224) 2022/06/28 23:08:39 [DEBUG] <<< TL_users_getUsers (#7114400806707543024) 2022/06/28 23:08:39 [DEBUG] >>> TL_rpc_result -> VectorObject 2022/06/28 23:08:39 [DEBUG] <<< TL_msgs_ack (#7114400806759130324) 2022/06/28 23:08:39 [INFO] Seems authed. 2022/06/28 23:08:39 [INFO] logged in as John Jr (DeportesVid) #5459985716 2022/06/28 23:08:39 [DEBUG] <<< TL_messages_getDialogs (#7114400806766001324) 2022/06/28 23:08:39 [DEBUG] >>> TL_rpc_result -> TL_messages_dialogs 2022/06/28 23:08:39 [DEBUG] <<< TL_msgs_ack (#7114400807040977724) 2022/06/28 23:08:39 [WARN] no chats match filter {"title":"Export_Channel_AccsMarketsklad","username":"AccsMarketsklad"} 2022/06/28 23:08:39 [WARN] no chats match filter {"title":"TheGroup","media_max_size":"2000M"}

F:\Telegram\Export\Go_Dump>type config.json { "app_id": 1234567, "app_hash": "XXXXXXXXXXXXXX", "request_interval_ms": 1000, "session_file_path": "tg.session", "out_dir_path": "F:/Telegram/Export/Go_Dump/", "history": [ {"title": "Export_Channel_AccsMarketsklad", "username": "AccsMarketsklad"} ], "media": [ {"title": "TheGroup", "media_max_size": "2000M"} ], "history_limit": { "10000": [ "all" ] }, "dump_account": "off", "dump_contacts": "off", "dump_sessions": "off" }

F:\Telegram\Export\Go_Dump>

Note: the user name is the name I got from IDBot, the word after "@" sign. Let me know what this should be, and if this setting is not correct: {"title":"TheGroup","media_max_size":"2000M"} Then let me know what the correct setting looks like. Thanks,

3bl3gamer commented 2 years ago

Do you want to export history from channel Export_Channel_AccsMarketsklad and export media from group TheGroup?

  1. You have to join these channel and group (if not already).

  2. {"title": "Export_Channel_AccsMarketsklad", "username": "AccsMarketsklad"} means that some chat/channel must have Export_Channel_AccsMarketsklad title and @AccsMarketsklad username at the same time. Usually it is not necessary to specify both.

  3. "media": [{"title": "TheGroup" will work only if history is also dumped for this chat.

Both chat and channel are not found for your account. That means that you either not joined them, or there is a typo in username/titles. Maybe [-list-chats](https://github.com/3bl3gamer/tg_history_dumper#listing-chats) argument will be helpful.

zydjohnHotmail commented 2 years ago

Hello: I change my config file, so it looks like this: F:\Telegram\Export\Go_Dump>type config.json { "app_id": 1234567, "app_hash": "XXXXXXX", "request_interval_ms": 1000, "session_file_path": "tg.session", "out_dir_path": "F:/Telegram/Export/Go_Dump/", "history": [ {"title": "Accsmarket.com", "username": "accsmarket"} ], "media": [ {"title": "Accsmarket.com", "media_max_size": "2000M"} ], "history_limit": { "10000": [ "all" ] }, "dump_account": "off", "dump_contacts": "off", "dump_sessions": "off" } F:\Telegram\Export\Go_Dump> I want to export chats from this public channel: accsmarket and all the media files from the same public channel. I can see some information from the exported chats and users file. But I still don't quite understand how to write a good config.json file. I will try it again tomorrow, as today, I already get too many verification code. Thanks for your help!

zydjohnHotmail commented 2 years ago

Hello: Today, I tried to use the repo again. Luckily, it works mostly well. But I got one warn message, then dump stuck: ...... 2022/06/29 09:31:18 [INFO] downloading file to F:/Telegram/Export/Go_Dump/Channel/files/1136983046_Accsmarket.com/265_Media_video_201p.mp4 2022/06/29 09:31:18 [WARN] got RPC result (mtproto.TL_upload_file) for unknown message #7114561262858606088 I have tried to export other channel chats, I also got the same issues, export stuck and never continue as long as such [WARN] messages appear.
Is it possible to simply ignore this kind of warning messages? Let me know how to fix this issue. Thanks,

3bl3gamer commented 2 years ago

It was one more Windows-related bug. Due to lower timer resolution some outgoing packets got same IDs, one of responses was overwritten, and client waited for it forever.

Fixed that, you can update and try again.

zydjohnHotmail commented 2 years ago

Hello: Thanks for your help. Now, I got other issues. I will close this one and open another one. Thanks,