Skip to main content

Whatsapp-Chat-Exporter

Latest in Pypi License MIT Python

A customizable Android and iPhone Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON.
If you plan to uninstall WhatsApp or delete your WhatsApp account, please make a backup of your WhatsApp database. You may want to use this exporter again on the same database in the future as the exporter develops

Usage

If you want to use the old release (< 0.5) of the exporter, please follow the old usage guide

First, install the exporter by:

pip install whatsapp-chat-exporter
pip install whatsapp-chat-exporter[android_backup]  & :: Optional, if you want it to support decrypting Android WhatsApp backup.

Then, create a working directory in somewhere you want

mkdir working_wts
cd working_wts

Working with Android

Unencrypted WhatsApp database

Extract the WhatsApp database with whatever means, one possible means is to use the WhatsApp-Key-DB-Extractor

After you obtain your WhatsApp database, copy the WhatsApp database and media folder to the working directory. The database is called msgstore.db. If you also want the name of your contacts, get the contact database, which is called wa.db. And copy the WhatsApp (Media) directory from your phone directly.

And now, you should have something like this in the working directory.

Android folder structure

Extracting

Simply invoke the following command from shell.

wtsexporter -a

Encrypted Android WhatsApp Backup

In order to support the decryption, install pycryptodome if it is not installed

pip install pycryptodome # Or 
pip install whatsapp-chat-exporter["android_backup"] # install along with this software

Crypt12 or Crypt14

Place the decryption key file (key) and the encrypted WhatsApp Backup (msgstore.db.crypt14) in the working directory. If you also want the name of your contacts, get the contact database, which is called wa.db. And copy the WhatsApp (Media) directory from your phone directly.

And now, you should have something like this in the working directory.

Android folder structure with WhatsApp Backup

Extracting

Simply invoke the following command from shell.

wtsexporter -a -k key -b msgstore.db.crypt14

Crypt15 (End-to-End Encrypted Backup)

To support Crypt15 backup, install javaobj-py3 if it is not installed

pip install javaobj-py3 # Or 
pip install whatsapp-chat-exporter["crypt15"] # install along with this software

Place the encrypted WhatsApp Backup (msgstore.db.crypt15) in the working directory. If you also want the name of your contacts, get the contact database, which is called wa.db. And copy the WhatsApp (Media) directory from your phone directly.
If you do not have the 32 bytes hex key (64 hexdigits), place the decryption key file (encrypted_backup.key) extracted from Android. If you gave the 32 bytes hex key, simply put the key in the shell.

Now, you should have something like this in the working directory (if you do not have 32 bytes hex key).

Android folder structure with WhatsApp Crypt15 Backup

Extracting

If you do not have 32 bytes hex key but have the key file available, simply invoke the following command from shell.

wtsexporter -a -k encrypted_backup.key -b msgstore.db.crypt15

If you have the 32 bytes hex key, simply put the hex key in the -k option and invoke the command from shell like this:

wtsexporter -a -k 432435053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cdaa5a8 -b msgstore.db.crypt15

Working with iPhone

Do an iPhone Backup with iTunes first.

Encrypted iPhone Backup

If you are working on unencrypted iPhone backup, skip this

If you want to work on an encrypted iPhone Backup, you should install iphone_backup_decrypt from KnugiHK/iphone_backup_decrypt before you run the extract_iphone_media.py.

pip install git+https://github.com/KnugiHK/iphone_backup_decrypt

Extracting

Simply invoke the following command from shell, remember to replace the username and device id correspondingly in the command.

wtsexporter -i -b "C:\Users\[Username]\AppData\Roaming\Apple Computer\MobileSync\Backup\[device id]"

Results

After extracting, you will get these:

Private Message

Private Message

Group Message

Group Message

More options

Invoke the wtsexporter with --help option will show you all options available.

> wtsexporter --help
Usage: wtsexporter [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -a, --android         Define the target as Android
  -i, --iphone          Define the target as iPhone
  -w WA, --wa=WA        Path to contact database
  -m MEDIA, --media=MEDIA
                        Path to WhatsApp media folder
  -b BACKUP, --backup=BACKUP
                        Path to Android (must be used together with -k)/iPhone
                        WhatsApp backup
  -o OUTPUT, --output=OUTPUT
                        Output to specific directory
  -j, --json            Save the result to a single JSON file
  -d DB, --db=DB        Path to database file
  -k KEY, --key=KEY     Path to key file
  -t TEMPLATE, --template=TEMPLATE
                        Path to custom HTML template

To do

  1. Reply in iPhone

Copyright

This is a MIT licensed project.

The Telegram Desktop's export is the reference for whatsapp.html in this repo

Release files for whatsapp-chat-exporter 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatsapp-chat-exporter 0.8.0
File Size Uploaded
whatsapp-chat-exporter-0.8.0.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whatsapp-chat-exporter 0.8.0
File Interpreter ABI Platform
whatsapp_chat_exporter-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.4 kB

Release files / whatsapp-chat-exporter-0.8.0.tar.gz

Download URL whatsapp-chat-exporter-0.8.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d5087c2aa9126f456b28231e1fdf882b4da57945b718dae85397e99da08c909e
BLAKE2b-256 checksum
How to use checksums
b55acb3cf9efaddb051f1e512b5e0060afbbf3c8be4ee0871a4d8aaf00e9a631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / whatsapp_chat_exporter-0.8.0-py3-none-any.whl

Download URL whatsapp_chat_exporter-0.8.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22d45a6205845e4ec763d103bda9b1f56b559a7bee4d9108815f5abbb1a67625
BLAKE2b-256 checksum
How to use checksums
bda2c819b7c7b8bb06c96d3afd41692336d43dbcf441b232a199d48a354087a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.0

2 release files

0.10.5

2 release files

0.9.7

2 release files

0.9.5

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.5

2 release files

0.8.2

2 release files

0.8.1

2 release files

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page