whatsapp-insights is a Python project for getting insights about your contacts/messages in WhatsApp. The main features are generating a chart race video and a insights cards image.
Before try this project out read Disclaimer section.
You need have installed in your machine following tools:
- Python 3.8
- Android SDK (for database key extraction)
- ChromeDriver for your Chrome browser version (for contact profile image extraction)
Also, have installed the latest version of WhatsApp in your smartphone.
After you have installed all pre-requisites, run following command to clone this project:
git clone https://github.com/Igorxp5/whatsapp-insights
Then access the cloned project folder and install all Python requirements:
cd whatsapp-insights
pip install -r requirements.txt
Status: NOT WORKING
Currently we support just accounts running in Android platform. If you're an iOS user, you can try to pull your WhatsApp database using WhatsApp Parser Tool or moving your Account to an Android device like Android Emulator. You are still able to generate the chart race video without extracting the database, using Export Chat feature, see Generate Chart Race video section.
Unfortunetaly extract WhatsApp database requires a lot of steps/dependencies. To use generating insights image and generating chart race video features extract WhatsApp database by yourself. You can backup your messages to Google Drive, login into your WhatsApp account on an Android Emulator, restore the backup and pull /data/data/com.whatsapp/databases/msgstore.db.
Database backup for Android platform is stored at /sdcard/WhatsApp/Databases. You can access it using your Android File Manager, but you can't read it because it's encrypted. The only way to read it, it's having the key to decrypt it. That key is stored in internal directory of the app at /data/data/com.whatsapp/files, but you can't access it. For key extraction we're gonna use an Android Emulator with root permissions to access internal files of WhatsApp.
Note: During this process you will be disconnected from your WhatsApp account in your device.
Note²: Before extracting the database key using this tool, backup your messages in Settings > Chats > Chat Backup.
python main.py extract-key
- --no-backup: For default the tool opens the WhatsApp in your device connected to the machine, and trigger the back up.
- --serial: Pass your Android device serial connected to the machine (if you have more than one connected).
- --show-emulator: If you want to follow login steps seeing what's going on the emulator, you can add that flag.
See more options running python main.py extract-key --help
.
Status: NOT WORKING
For WhatsApp database extraction you need the key databae already in the workspace folder, it will be needed for decrypting step.
python main.py extract-database
- --no-backup: For default the tool opens the WhatsApp in your device connected to the machine, and trigger the back up.
- --serial: Pass your Android device serial connected to the machine (if you have more than one connected).
See more options running python main.py extract-database --help
.
To show your contacts profile image in the chart race video or insights image, you need to extract those images. This tool connects to your account via WhatsApp Web and get the images of all your contacts that you've messaged (excluding group profile images). You need provide the msgtore.db
file to the script, so it can pull just contact profile images.
python main.py extract-profile-images
- --msg-store: If you have saved
msgstore.db
out of the project workspace in you can pass the path to it here. - --chromedriver: Pass here the chromedriver binary for your Chrome brower version.
- --output: Directory where to save the contacts profile images.
- --update-existent-images: Extract contacts profile images even it is already downloaded.
See more options running python main.py extract-profile-images --help
.
To get contact names, both of the main features of this project requires VCF file containing contact info. You can export that using your Contacts app. The profile images in the vcf file is imported as well.
The project may not work well to match the messages' contact to your vcf file' contacts if the phone numbers in your contacts (vcf file) are correctly formatted: +CCDDDPPPPPPPPP.
Legend:
- CC: Contry code
- DDD: Area Code
- PPPPPPPPPP: Phone Number
To create the insights image you need msgstore.db
, export your contacts to vcf
file and your contacts profile images.
python main.py generate-image --contacts contacts.vcf --msg-store msgstore.db --profile-pictures-dir ./profile_pictures
- --contact:
vcf
file containg your contacts. You can export that using Android Contacts app. - --msg-store: If you have saved
msgstore.db
out of the project workspace in you can pass the path to it here. - --locale: Set the language of the insights descriptions. Currenly supporting:
en_US
andpt_BR
. - --profile-pictures-dir: Directory with your contacts profile images. Set this if you have saved them out of the project workspace.
- --top-insighters: Set the insighter to be present in the top of the image. See Insighters section.
- --insighters: Set the insighters to be present in the cards of the image (separated by whitespace). You can choose up to 6 insighters. See Insighters section.
See more options running python main.py generate-image --help
.
Like generating insights image, for generate chart race video you need msgstore.db
, export your contacts to vcf
file and your contacts profile images.
python main.py generate-video --contacts contacts.vcf --msg-store msgstore.db --profile-pictures-dir ./profile_pictures
- --contact:
vcf
file containg your contacts. You can export that using Android Contacts app. - --msg-store: If you have saved
msgstore.db
out of the project workspace in you can pass the path to it here. - --locale: Set the language of the insights descriptions. Currenly supporting:
en_US
andpt_BR
. - --profile-pictures-dir: Directory with your contacts profile images. Set this if you have saved them out of the project workspace.
- --exclude-no-display-name-contacts: Not include contacts without display name.
- --from-export-chats: Export your chats in Individual Chat > More > Export chat. You have to do it manually for all contacts you want presnt in the video generated. Pass the folder where all the text files are. Note, that WhatsApp feature is limited to export 40,000 messages.
For generating insights image, you currently have some insighters:
- LongestAudioInsighter: The user with the longest audio among your messages.
- GreatestAudioAmountInsighter: The user that sent you the greatest amount of audio messages.
- GreatestAmountOfDaysTalkingInsighter: The user that you've talked for more days.
- GreatestPhotoAmountInsighter: The user that sent you the greatest amount of photos.
- GreatestMessagesAmountInsighter: The user that sent you the greatest amount of messages in general.
- LongestConversationInsighter: The user that you spent more time talking without exit from the chat (messages separated by a maximum of 1 minute).
- GreatestMyStatusAnsweredInsighter: The user that answered your status more than anyone other contact.
- LongestCallInsighter: The user that you spent more time in a single call.
- GreatestCallAmountInsighter: The user that made with you the greatest amount of calls.
- LongestTimeInCallsInsighter: The user that you spent more time in calls in the total.
The process to get those insights requires you pull your WhatsApp message database and key to decrypt the database of your account. Be careful about exposing those two files, anyone can read your WhatsApp messages history having them.
Using automated scripts/third-party programs for accessing the WhatsApp services are not allowed by WhatsApp Terms of Service. Use the project at your own risk.
Any contributor of this project is not responsible, and expressly disclaims all liability for damages of any kind arising from the use, reference or reliance on this tool.
- Profile images for demonstratation from https://thispersondoesnotexist.com/.
- Decrypt WhatsApp database code from https://github.com/B16f00t/whapa/.