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

Date created on media files set to date of export instead of original date created #65

Closed pimduin closed 7 months ago

pimduin commented 9 months ago

In the resulting export the "date created" on each file is set to the date the exporter is run.

In case of the media files, is it possible for these files to retain their original "date created" dates after an export?

KnugiHK commented 9 months ago

Hi. Are you working on Android or iOS?

It is possible to change the modify and access date with os.utime easily. However, the creation date seems to requires some extra efforts or libraries. I will look into it.

pimduin commented 9 months ago

I'm running the tool on an iOS backup. Thank you for looking into it.

KnugiHK commented 9 months ago

You can now try the --preserve-timestamp flag from the dev branch, which will preserve the modification time of the extracted media files.

As for creation time, it is very platform-dependent and may require other dependencies. Therefore, it may or may not be implemented, given that the feature is not the main focus of the exporter.

pimduin commented 9 months ago

I just tested it out, it did not work at first on an encrypted iOS backup. When using an unencrypted backup the new command line option seems to work! Thanks a lot!

I'm in the process of archiving parts of the whatsapp media from the backup to my photo collection software. Having a proper creation date is a huge help in this case.

I will be going though all media eventually, if I happen to notice something off I will report it.

By the way, this is the error I get when using an encrypted iOS backup:

* Command:
wtsexporter -i --preserve-timestamp -b ./backup_folder

* Output:
Encryption detected on the backup!
Enter the password for the backup:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 292, in main
    extract_iphone_media.extract_media(args.backup, identifiers, args.preserve_timestamp)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/extract_iphone_media.py", line 84, in extract_media
    extract_encrypted(base_dir, password, identifiers)
TypeError: extract_encrypted() missing 1 required positional argument: 'preserve_timestamp'
KnugiHK commented 9 months ago

I just tested it out, it did not work at first on an encrypted iOS backup. When using an unencrypted backup the new command line option seems to work! Thanks a lot!

Yes. It has yet to be implemented on encrypted backup, as it involves another module.

By the way, this is the error I get when using an encrypted iOS backup:

However, regarding the error you encountered, it should fixed with 380289d.

KnugiHK commented 9 months ago

As per 8eb0542, the timestamp should also be preserved when working with encrypted backup. Remember to install the latest iphone_backup_decrypt.

I will leave this open until next release.

KnugiHK commented 7 months ago

Released in 0.9.7.