Little python script to analyze and export your Whatsapp chats from the Whatsapps chat database. It creates some beautiful plots, an HTML and a LaTeX version of the chat history.
Printing HTML files to PDFs can be a problem for large chat histories. With the LaTeX version, you can create a beautiful (printable) PDF version of all your messages (with all emojis). (see below)
With the built-in export functionality you can only export the last 10,000 (with images) or 40,000 (without images) messages. Using the database you can analyze your complete chat history.
- Option: Your phone is rooted. Just copy the file
msgstore.db
from the directory/data/data/app/com.whatsapp/databases
to your computer. - Option: You have a Huawei Phone. In this case, follow these instructions.
There may be other possibilities to get your message database like decrypting the sd-card backup, but they will not be discussed here.
Download or clone the repository and run
foo@bar:~$ python whatsapp-stats.py --phone_number '+49 170 00000000' 'C:\PathToFile\msgstore.db' --mode tex
Available mode
s are normal
(default, no html or LaTeX generation), html
(generates html) and tex
(generates tex). They can also be combined: html|tex
.
See all available options with
foo@bar:~$ python whatsapp-stats.py --help
With the generated .tex
file you can create a beautiful PDF version of your chat history which includes all emojis. Printing HTML files to a PDF with a normal computer is only possible for a small number of pages. PDF generation by LaTeX is much more efficient. Follow these steps to create your PDF file:
- If not already done: Download and install a LaTeX distribution (which comes with the
lualatex
package, probably all common distributions do that) - If you want to display your emojis correctly, copy the contents of this coloremoji repository to your tex-output folder (probably
output/tex
).
Pay attention, that the directorycoloremoji
and the filecoloremoji.sty
are in the same directory as yourchat.tex
. - Outcomment
\usepackage{coloremoji}
in line 15 of yourchat.tex
. - Navigate a terminal to the directory of your
chat.tex
and runYou can use other LaTeX compiler but for mefoo@bar:~$ lualatex chat.tex
lualatex
worked the best for non-ASCII characters and very large chat histories.
The script is licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html.
This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This script is an independent and unofficial. Use at your own risk.