gumblex / tg-export

Export Telegram messages.
GNU Lesser General Public License v3.0
57 stars 9 forks source link

Is it possible to only export single peer messages #1

Closed 4r1y4n closed 6 years ago

4r1y4n commented 8 years ago

Is it possible to only export one (or multiple) peers rather than exporting the entire history? What about files & media?

gumblex commented 8 years ago

Yes, it's possible. The entire history is retrieved by iterating over the dialog list, while files & media can be downloaded via telegram-cli given a message id. Not downloading them is just for time/space/bandwidth efficiency. If you want to get a text or html history for one peer, you can use the logfmt.py.

Please tell me what do you think about the proposed feature's command line interface. Adding a -p [peer_id], -m [media_message_id], --with-media or a separate program?

cxumol commented 6 years ago

image

As shown in the photo above, this feature failed now but it was tg-cli's fault since I met the same problem from another tg-cli based project

By the way, peer_id was not working for me (-p 1001020xxx, for example). It turned out as "Peer Not Found".

Come on! let's switch to Telethon!

gumblex commented 6 years ago

@cxumol I didn't understand what you mean. What is the bug about?

I will see how to use Telethon if I have time. (soon :tm:)

cxumol commented 6 years ago

@gumblex The bug is some of the retrieved messages were not from the assigned peer_chat.

it was appeared once (or more) when I was trying tvdstaaij/telegram-history-dump, too.

The problem was reproduced by specifying another channel. By the way, my environment was a newly installed Debian 8 x86_64 with <gumblex/tg-cli>. Other dependencies were installed through Debian 8 default source.

gumblex commented 6 years ago

This problem is not considered a bug but a feature. When the program is exporting, new unread messages pushed by the server are stored as well. Use logfmt.py to get txt or html, or just do DELETE FROM messages WHERE dest=<your_chat_id>.

The -p argument is explained in the new commits.