whatsapp-chat-exporter


Namewhatsapp-chat-exporter JSON
Version 0.9.7 PyPI version JSON
download
home_pagehttps://github.com/KnugiHK/Whatsapp-Chat-Exporter
SummaryA Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Android, iOS, iPadOS, Crypt12, Crypt14, Crypt15 supported.
upload_time2023-11-12 06:33:19
maintainer
docs_urlNone
authorKnugiHK
requires_python>=3.8
licenseMIT
keywords android ios parsing history iphone message crypt15 customizable whatsapp android-backup messages crypt14 crypt12 whatsapp-chat-exporter whatsapp-export iphone-backup whatsapp-database whatsapp-database-parser whatsapp-conversations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Whatsapp-Chat-Exporter
[![Latest in Pypi](https://img.shields.io/pypi/v/whatsapp-chat-exporter?label=Latest%20in%20Pypi)](https://pypi.org/project/whatsapp-chat-exporter/)
![License MIT](https://img.shields.io/pypi/l/whatsapp-chat-exporter)
[![Python](https://img.shields.io/pypi/pyversions/Whatsapp-Chat-Exporter)](https://pypi.org/project/Whatsapp-Chat-Exporter/)

A customizable Android and iPhone Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Inspired by [Telegram Chat Export Tool](https://telegram.org/blog/export-and-more).  
**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
**Usage in README may be removed in the future. Check the usage in [Wiki](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/wiki)**.

**If you want to use the old release (< 0.5) of the exporter, please follow the [old usage guide](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/wiki/Old-Usage#usage)**.

First, install the exporter by:
```shell
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
```shell
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](https://github.com/KnugiHK/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](imgs/android_structure.png)
#### Extracting
Simply invoke the following command from shell.
```sh
wtsexporter -a
```

### Encrypted Android WhatsApp Backup
In order to support the decryption, install pycryptodome if it is not installed
```sh
pip install pycryptodome # Or 
pip install whatsapp-chat-exporter["android_backup"] # install along with this software
```
### Crypt15 is now the easiest way to decrypt a backup. If you have the 32 bytes hex key generated when you enable End-to-End encrypted backup, you can use it to decrypt the backup. If you do not have the 32 bytes hex key, you can still use the key file extracted just like extacting key file for Crypt12 and Crypt14 to decrypt the backup.
#### Crypt12 or Crypt14
You will need the decryption key file from your phone. If you have root access, you can find it as `/data/data/com.whatsapp/files/key`. Otherwise, if you used WhatsApp-Key-DB-Extractor before, it will appear in the WhatsApp backup directory as `WhatsApp/Databases/.nomedia`.

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](imgs/android_structure_backup.png)
#### Extracting
Simply invoke the following command from shell.
```sh
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
```sh
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](imgs/android_structure_backup_crypt15.png)
##### Extracting
If you do not have 32 bytes hex key but have the key file available, simply invoke the following command from shell.
```sh
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:
```sh
wtsexporter -a -k 432435053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cdaa5a8 -b msgstore.db.crypt15
```

## Working with iOS/iPadOS (iPhone or iPad)
Do an iPhone/iPad Backup with iTunes first.
* iPhone backup on Mac: https://support.apple.com/HT211229
* iPhone backup on Windows: https://support.apple.com/HT212156
* iPad backup: https://support.apple.com/guide/ipad/ipad9a74df05xx/ipados
### Encrypted iOS/iPadOS Backup
**If you are working on unencrypted iOS/iPadOS backup, skip this**

If you want to work on an encrypted iOS/iPadOS Backup, you should install iphone_backup_decrypt from [KnugiHK/iphone_backup_decrypt](https://github.com/KnugiHK/iphone_backup_decrypt) before you run the extract_iphone_media.py.
```sh
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.
#### Windows
```sh
wtsexporter -i -b "C:\Users\[Username]\AppData\Roaming\Apple Computer\MobileSync\Backup\[device id]"
```
#### Mac
```sh
wtsexporter -i -b ~/Library/Application\ Support/MobileSync/Backup/[device id]
```

## Results
After extracting, you will get these:
#### Private Message
![Private Message](imgs/pm.png)

#### Group Message
![Group Message](imgs/group.png)

## More options
Invoke the wtsexporter with --help option will show you all options available.
```sh
> wtsexporter --help
usage: wtsexporter [-h] [-a] [-i] [-e EXPORTED] [-w WA] [-m MEDIA] [-b BACKUP] [-o OUTPUT] [-j [JSON]] [-d DB] [-k KEY] [-t TEMPLATE] [-s] [-c] [--offline OFFLINE] [--size [SIZE]]
                   [--no-html] [--check-update] [--assume-first-as-me]

options:
  -h, --help            show this help message and exit
  -a, --android         Define the target as Android
  -i, --iphone, --ios   Define the target as iPhone/iPad
  -e EXPORTED, --exported EXPORTED
                        Define the target as exported chat file and specify the path to the file
  -w WA, --wa WA        Path to contact database (default: wa.db/ContactsV2.sqlite)
  -m MEDIA, --media MEDIA
                        Path to WhatsApp media folder (default: WhatsApp)
  -b BACKUP, --backup BACKUP
                        Path to Android (must be used together with -k)/iPhone WhatsApp backup
  -o OUTPUT, --output OUTPUT
                        Output to specific directory (default: result)
  -j [JSON], --json [JSON]
                        Save the result to a single JSON file (default if present: result.json)
  -d DB, --db DB        Path to database file (default: msgstore.db/7c7fba66680ef796b916b067077cc246adacf01d)
  -k KEY, --key KEY     Path to key file
  -t TEMPLATE, --template TEMPLATE
                        Path to custom HTML template
  -s, --showkey         Show the HEX key used to decrypt the database
  -c, --move-media      Move the media directory to output directory if the flag is set, otherwise copy it
  --offline OFFLINE     Relative path to offline static files
  --size [SIZE], --output-size [SIZE], --split [SIZE]
                        Maximum (rough) size of a single output file in bytes, 0 for auto
  --no-html             Do not output html files
  --check-update        Check for updates (require Internet access)
  --assume-first-as-me  Assume the first message in a chat as sent by me (must be used together with -e)

WhatsApp Chat Exporter: 0.9.7 Licensed with MIT
```

# To do
See [issues](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/issues).

# Copyright
This is a MIT licensed project.

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

bplist.py was released by Vladimir "Farcaller" Pouzanov under MIT license.

WhatsApp Chat Exporter is not affiliated, associated, authorized, endorsed by, or in any way officially connected with the WhatsApp LLC, or any of its subsidiaries or its affiliates. The official WhatsApp LLC website can be found at https://www.whatsapp.com/.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KnugiHK/Whatsapp-Chat-Exporter",
    "name": "whatsapp-chat-exporter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "android,ios,parsing,history,iphone,message,crypt15,customizable,whatsapp,android-backup,messages,crypt14,crypt12,whatsapp-chat-exporter,whatsapp-export,iphone-backup,whatsapp-database,whatsapp-database-parser,whatsapp-conversations",
    "author": "KnugiHK",
    "author_email": "hello@knugi.com",
    "download_url": "https://files.pythonhosted.org/packages/52/19/945e17fe6ed5d4242f9ea4b6b919cea1fcad60dea62713f3c94740a62b0d/whatsapp-chat-exporter-0.9.7.tar.gz",
    "platform": "any",
    "description": "# Whatsapp-Chat-Exporter\n[![Latest in Pypi](https://img.shields.io/pypi/v/whatsapp-chat-exporter?label=Latest%20in%20Pypi)](https://pypi.org/project/whatsapp-chat-exporter/)\n![License MIT](https://img.shields.io/pypi/l/whatsapp-chat-exporter)\n[![Python](https://img.shields.io/pypi/pyversions/Whatsapp-Chat-Exporter)](https://pypi.org/project/Whatsapp-Chat-Exporter/)\n\nA customizable Android and iPhone Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Inspired by [Telegram Chat Export Tool](https://telegram.org/blog/export-and-more).  \n**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**\n\n# Usage\n**Usage in README may be removed in the future. Check the usage in [Wiki](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/wiki)**.\n\n**If you want to use the old release (< 0.5) of the exporter, please follow the [old usage guide](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/wiki/Old-Usage#usage)**.\n\nFirst, install the exporter by:\n```shell\npip install whatsapp-chat-exporter\npip install whatsapp-chat-exporter[android_backup]  :; # Optional, if you want it to support decrypting Android WhatsApp backup.\n```\nThen, create a working directory in somewhere you want\n```shell\nmkdir working_wts\ncd working_wts\n```\n## Working with Android\n### Unencrypted WhatsApp database\nExtract the WhatsApp database with whatever means, one possible means is to use the [WhatsApp-Key-DB-Extractor](https://github.com/KnugiHK/WhatsApp-Key-DB-Extractor)\n\nAfter 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.\n\nAnd now, you should have something like this in the working directory.\n\n![Android folder structure](imgs/android_structure.png)\n#### Extracting\nSimply invoke the following command from shell.\n```sh\nwtsexporter -a\n```\n\n### Encrypted Android WhatsApp Backup\nIn order to support the decryption, install pycryptodome if it is not installed\n```sh\npip install pycryptodome # Or \npip install whatsapp-chat-exporter[\"android_backup\"] # install along with this software\n```\n### Crypt15 is now the easiest way to decrypt a backup. If you have the 32 bytes hex key generated when you enable End-to-End encrypted backup, you can use it to decrypt the backup. If you do not have the 32 bytes hex key, you can still use the key file extracted just like extacting key file for Crypt12 and Crypt14 to decrypt the backup.\n#### Crypt12 or Crypt14\nYou will need the decryption key file from your phone. If you have root access, you can find it as `/data/data/com.whatsapp/files/key`. Otherwise, if you used WhatsApp-Key-DB-Extractor before, it will appear in the WhatsApp backup directory as `WhatsApp/Databases/.nomedia`.\n\nPlace 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.\n\nAnd now, you should have something like this in the working directory.\n\n![Android folder structure with WhatsApp Backup](imgs/android_structure_backup.png)\n#### Extracting\nSimply invoke the following command from shell.\n```sh\nwtsexporter -a -k key -b msgstore.db.crypt14\n```\n\n#### Crypt15 (End-to-End Encrypted Backup)\nTo support Crypt15 backup, install javaobj-py3 if it is not installed\n```sh\npip install javaobj-py3 # Or \npip install whatsapp-chat-exporter[\"crypt15\"] # install along with this software\n```\nPlace 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.  \nIf 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.\n\nNow, you should have something like this in the working directory (if you do not have 32 bytes hex key).\n\n![Android folder structure with WhatsApp Crypt15 Backup](imgs/android_structure_backup_crypt15.png)\n##### Extracting\nIf you do not have 32 bytes hex key but have the key file available, simply invoke the following command from shell.\n```sh\nwtsexporter -a -k encrypted_backup.key -b msgstore.db.crypt15\n```\nIf you have the 32 bytes hex key, simply put the hex key in the -k option and invoke the command from shell like this:\n```sh\nwtsexporter -a -k 432435053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cdaa5a8 -b msgstore.db.crypt15\n```\n\n## Working with iOS/iPadOS (iPhone or iPad)\nDo an iPhone/iPad Backup with iTunes first.\n* iPhone backup on Mac: https://support.apple.com/HT211229\n* iPhone backup on Windows: https://support.apple.com/HT212156\n* iPad backup: https://support.apple.com/guide/ipad/ipad9a74df05xx/ipados\n### Encrypted iOS/iPadOS Backup\n**If you are working on unencrypted iOS/iPadOS backup, skip this**\n\nIf you want to work on an encrypted iOS/iPadOS Backup, you should install iphone_backup_decrypt from [KnugiHK/iphone_backup_decrypt](https://github.com/KnugiHK/iphone_backup_decrypt) before you run the extract_iphone_media.py.\n```sh\npip install git+https://github.com/KnugiHK/iphone_backup_decrypt\n```\n### Extracting\nSimply invoke the following command from shell, remember to replace the username and device id correspondingly in the command.\n#### Windows\n```sh\nwtsexporter -i -b \"C:\\Users\\[Username]\\AppData\\Roaming\\Apple Computer\\MobileSync\\Backup\\[device id]\"\n```\n#### Mac\n```sh\nwtsexporter -i -b ~/Library/Application\\ Support/MobileSync/Backup/[device id]\n```\n\n## Results\nAfter extracting, you will get these:\n#### Private Message\n![Private Message](imgs/pm.png)\n\n#### Group Message\n![Group Message](imgs/group.png)\n\n## More options\nInvoke the wtsexporter with --help option will show you all options available.\n```sh\n> wtsexporter --help\nusage: wtsexporter [-h] [-a] [-i] [-e EXPORTED] [-w WA] [-m MEDIA] [-b BACKUP] [-o OUTPUT] [-j [JSON]] [-d DB] [-k KEY] [-t TEMPLATE] [-s] [-c] [--offline OFFLINE] [--size [SIZE]]\n                   [--no-html] [--check-update] [--assume-first-as-me]\n\noptions:\n  -h, --help            show this help message and exit\n  -a, --android         Define the target as Android\n  -i, --iphone, --ios   Define the target as iPhone/iPad\n  -e EXPORTED, --exported EXPORTED\n                        Define the target as exported chat file and specify the path to the file\n  -w WA, --wa WA        Path to contact database (default: wa.db/ContactsV2.sqlite)\n  -m MEDIA, --media MEDIA\n                        Path to WhatsApp media folder (default: WhatsApp)\n  -b BACKUP, --backup BACKUP\n                        Path to Android (must be used together with -k)/iPhone WhatsApp backup\n  -o OUTPUT, --output OUTPUT\n                        Output to specific directory (default: result)\n  -j [JSON], --json [JSON]\n                        Save the result to a single JSON file (default if present: result.json)\n  -d DB, --db DB        Path to database file (default: msgstore.db/7c7fba66680ef796b916b067077cc246adacf01d)\n  -k KEY, --key KEY     Path to key file\n  -t TEMPLATE, --template TEMPLATE\n                        Path to custom HTML template\n  -s, --showkey         Show the HEX key used to decrypt the database\n  -c, --move-media      Move the media directory to output directory if the flag is set, otherwise copy it\n  --offline OFFLINE     Relative path to offline static files\n  --size [SIZE], --output-size [SIZE], --split [SIZE]\n                        Maximum (rough) size of a single output file in bytes, 0 for auto\n  --no-html             Do not output html files\n  --check-update        Check for updates (require Internet access)\n  --assume-first-as-me  Assume the first message in a chat as sent by me (must be used together with -e)\n\nWhatsApp Chat Exporter: 0.9.7 Licensed with MIT\n```\n\n# To do\nSee [issues](https://github.com/KnugiHK/Whatsapp-Chat-Exporter/issues).\n\n# Copyright\nThis is a MIT licensed project.\n\nThe Telegram Desktop's export is the reference for whatsapp.html in this repo.\n\nbplist.py was released by Vladimir \"Farcaller\" Pouzanov under MIT license.\n\nWhatsApp Chat Exporter is not affiliated, associated, authorized, endorsed by, or in any way officially connected with the WhatsApp LLC, or any of its subsidiaries or its affiliates. The official WhatsApp LLC website can be found at https://www.whatsapp.com/.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Android, iOS, iPadOS, Crypt12, Crypt14, Crypt15 supported.",
    "version": "0.9.7",
    "project_urls": {
        "Homepage": "https://github.com/KnugiHK/Whatsapp-Chat-Exporter"
    },
    "split_keywords": [
        "android",
        "ios",
        "parsing",
        "history",
        "iphone",
        "message",
        "crypt15",
        "customizable",
        "whatsapp",
        "android-backup",
        "messages",
        "crypt14",
        "crypt12",
        "whatsapp-chat-exporter",
        "whatsapp-export",
        "iphone-backup",
        "whatsapp-database",
        "whatsapp-database-parser",
        "whatsapp-conversations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16218d97dd44061b775368897483e60792dc18ad3ce77af6fdc34256d6473b1c",
                "md5": "d415e7532631430f534192f679d6305a",
                "sha256": "ec61834572165b71d0928184bccee7ad91b55be605cbef8d4a687c81a55272e7"
            },
            "downloads": -1,
            "filename": "whatsapp_chat_exporter-0.9.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d415e7532631430f534192f679d6305a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 31882,
            "upload_time": "2023-11-12T06:33:17",
            "upload_time_iso_8601": "2023-11-12T06:33:17.799973Z",
            "url": "https://files.pythonhosted.org/packages/16/21/8d97dd44061b775368897483e60792dc18ad3ce77af6fdc34256d6473b1c/whatsapp_chat_exporter-0.9.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5219945e17fe6ed5d4242f9ea4b6b919cea1fcad60dea62713f3c94740a62b0d",
                "md5": "29413018128df2d36f11ebb2733233ba",
                "sha256": "7b33dfe64c8ba464c70bddb8f71a8b425fda1f6d807dc398c068f51e26194653"
            },
            "downloads": -1,
            "filename": "whatsapp-chat-exporter-0.9.7.tar.gz",
            "has_sig": false,
            "md5_digest": "29413018128df2d36f11ebb2733233ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30324,
            "upload_time": "2023-11-12T06:33:19",
            "upload_time_iso_8601": "2023-11-12T06:33:19.345096Z",
            "url": "https://files.pythonhosted.org/packages/52/19/945e17fe6ed5d4242f9ea4b6b919cea1fcad60dea62713f3c94740a62b0d/whatsapp-chat-exporter-0.9.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-12 06:33:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KnugiHK",
    "github_project": "Whatsapp-Chat-Exporter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "whatsapp-chat-exporter"
}
        
Elapsed time: 0.14581s