KnugiHK / WhatsApp-Chat-Exporter

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.
https://wts.knugi.dev/
MIT License
518 stars 76 forks source link

[FEATURE] Export by a date range #82

Closed magpires closed 4 weeks ago

magpires commented 5 months ago

Is your feature request related to a problem? Please describe. I want to create a repository on Google Drive with my conversations, creating a folder for each year, however, the tool does not allow me to extract the conversations for a date range.

Describe the solution you'd like An option to inform the interval for extracting messages would be very welcome.

Additional context An example would be the command:

wtsexporter -d --between 2022-01-01 00:00 - 2023-01-01 00:00

KnugiHK commented 4 months ago

Hi. Thanks for your suggestion. The feature is implemented in 2466e25 and 2b49ac2. You can try them in the dev branch.

PS. Inspired by your suggestion, I think export by chat is also a good filter.

magpires commented 4 months ago

Hi. Today I tested the changes you made in the dev branch and I thought they were amazing. However, there was an exception error, regarding the timezone_offset parameter that you try to assign a value to in the dataModel Message. I have a little knowledge of Python and, from what I've seen, your code tries to assign a value to an attribute that doesn't exist, thus generating the exception. When I commented out the line that made this assignment, the application worked without problems. The exception occurs on line 346 of the android_handler.py file. I hope, in some way, to be contributing to the project.

KnugiHK commented 4 months ago

Can you post the stack traceback and the command you used?

magpires commented 4 months ago

Can you post the stack traceback and the command you used?

I used the following command in question

python main.py -a --split 900000 --date "2023-01-01 00:00 - 2024-01-01 00:00"

The traceback was this

Traceback (most recent call last):
 File "C:\Users\user\Desktop\Temps\WhatsApp\WhatsApp-Chat-Exporter-dev\Whatsapp_Chat_Exporter\main.py", line 497, in <module>
 main()
 File "C:\Users\user\Desktop\Temps\WhatsApp\WhatsApp-Chat-Exporter-dev\Whatsapp_Chat_Exporter\main.py", line 420, in main
 messages(db, data, args.media, args.timezone_offset, args.filter_date, filter_chat)
 File "C:\Users\user\Desktop\Temps\WhatsApp\WhatsApp-Chat-Exporter-dev\Whatsapp_Chat_Exporter\android_handler.py", line 341, in messages
 message = Message(
 TypeError: Message.init() got an unexpected keyword argument 'timezone_offset'

The exception persists even if I pass a value for time-offset using the argument "--time-offset -3"

KnugiHK commented 4 months ago

Could you please check the Message.__init__ in the data_model.py file? The timezone_offset should be there. See this link.

magpires commented 4 months ago

Could you please check the Message.__init__ in the data_model.py file? The timezone_offset should be there. See this link.

Hey! I redid the tests, because I realized that I was having a conflict between the dev version and the main version on my machine. By redoing the tests correctly, I was successful. There was no error now.

KnugiHK commented 4 months ago

I will leave this open until next release.

KnugiHK commented 4 weeks ago

Released in 0.10.0.