Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to easily tell the (protected) chat message url #129

Closed
suntong opened this issue Mar 14, 2023 · 10 comments
Closed

How to easily tell the (protected) chat message url #129

suntong opened this issue Mar 14, 2023 · 10 comments

Comments

@suntong
Copy link

suntong commented Mar 14, 2023

Download (protected) chat files from message urls:
tdl dl -u https://t.me/tdl/1 -u https://t.me/tdl/2

So how to get such (protected) chat message url like above? (I poked around in my own chats/groups but was never able to figure it out from the UI...) thx.

@iyear
Copy link
Owner

iyear commented Mar 15, 2023

  1. Export the history you need via tdl chat export. For more information:https:/iyear/tdl/blob/master/docs/desktop_export.md
  2. Use tdl dl -f EXPORTED_FILE to download the media.

But frankly, it's still a lot of work. I've thought about making a simple TUI to simply browse the history, but that would require research and time.

@suntong
Copy link
Author

suntong commented Mar 15, 2023

Hmm..., there should be a way to get how many (total) messages have been sent in a group/channel, right?

If so, output that number in tdl chat ls, then at least for the last several messages of a group/channel, we can construct the urls ourselves.

@iyear
Copy link
Owner

iyear commented Mar 16, 2023

Yes. Chat utils are rather rudimentary at the moment. Do you have better suggestions?

@suntong
Copy link
Author

suntong commented Mar 16, 2023

So, is there any way to get how many (total) messages have been sent in a group/channel?

@iyear
Copy link
Owner

iyear commented Mar 17, 2023

No. You can try exporting using tdl chat export --time. But none of these methods are elegant. I will add the max message id in the next version of tdl chat export as a temp solution.

I'm building TUI that can be used to visually export chat links. Do you have better ideas or suggestions? Thanks!

@suntong
Copy link
Author

suntong commented Mar 17, 2023

I will add the max message id in the next version of tdl chat export as a temp solution.

Thanks, yeah, this is the easiest/quickest fix for a working solution, albeit not very elegant, as we still have to construct the urls ourselves. Or,

Maybe add another cli sub-command instead, getlast or something, so that it'll output the last message url according to the dl format, based on the max message id. Else, just output it after each group/channel in tdl chat ls without introducing another cli sub-command.

That might be a more helpful solution.

@iyear
Copy link
Owner

iyear commented Mar 17, 2023

Looks like a better solution. Thanks!

@iyear
Copy link
Owner

iyear commented Mar 23, 2023

The new version has been released, feel free to try it or reopen the issue.

@iyear iyear closed this as completed Mar 23, 2023
@suntong
Copy link
Author

suntong commented Mar 23, 2023

So I tried it with one of my group and got this:

{"id":608310358,"messages":[{"id":678251,"type":"message","file":"0"},{"id":678250,"type":"message","file":"0"},{"id":678249,"type":"message","file":"0"},{"id":677922,"type":"message","file":"0"},{"id":677921,"type":"message","file":"0"}]}

So,

  • what's the last message url according to the tdl dl format? Is it https://t.me/c/608310358/678251? Why TG says that I have no access to my own group from that url?
  • why there is such a huge skipping in the message ids (over 320, from 678249 down to 677922)? I didn't delete any of the messages in that group.

To illustrate it, I got into a group that we both are in, and the last 15 message ids are:

{"id":1174669987,"messages":[{"id":39976,"type":"message","file":"0"},{"id":39974,"type":"message","file":"0"},{"id":39971,"type":"message","file":"0"},{"id":39966,"type":"message","file":"0"},{"id":39916,"type":"message","file":"0"},{"id":39905,"type":"message","file":"0"},{"id":39885,"type":"message","file":"0"},{"id":39884,"type":"message","file":"0"},{"id":39883,"type":"message","file":"0"},{"id":39882,"type":"message","file":"0"},{"id":39881,"type":"message","file":"0"},{"id":39876,"type":"message","file":"0"},{"id":39874,"type":"message","file":"0"},{"id":39873,"type":"message","file":"0"},{"id":39869,"type":"message","file":"0"}]}

As we can see there is a skip between 39976 and 39974, yet if I construct a message url of https://t.me/c/1174669987/39975, that url exist and message accessible.

Moreover, the 39976 is not the last message id. There are still 3 more messages after it, as we speak.

Please double-check.

@iyear
Copy link
Owner

iyear commented Mar 24, 2023

  • tdl export only count messages that contains media, instead of all messages.
  • tdl export should be used with tdl dl -f

So, workflow is

tdl export xxxxx -o export.json
tdl dl -f export.json

See README download section for details.

@suntong suntong mentioned this issue May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants