The idea of archiving your WhatsApp conversations in printed form seemed beautiful. I first came across this idea in a blog post by Pelle Beckman. The code below is my take on this beautiful idea.
WhatsApp has a little know feature that allows one to export a certain chat to a parsable format. After extracting the resulting export has a single _chat.txt
file that contains the entire chat conversation. Additionally the different attachments are present with a simple time stamp and numerical index.
chatExport.zip
|-- _chat.txt
|-- 2017-04-13-PHOTO-00000001.jpg
|-- 2017-04-13-PHOTO-00000002.jpg
|-- 2017-04-13-AUDIO-00000003.aac
|-- 2017-04-13-AUDIO-00000004.opus
|-- 2017-04-13-VIDEO-00000005.mp4
To use the WhatsBook.py
simply clone the repository and drag the extracted WhatsApp export to the main folder. One can then run the script as a simple oneliner given below or without any arguments to start the guided set-up.
git clone https://github.com/theveloped/WhatsBook.git
cd WhatsBook
python whatsBook.py exportDirectory > content.tex
I then used pdfLaTeX
to render the output to pdf. If the output of the script was named content.tex
as indicated above, one should be able to build whatsBook.tex
without any changes.
There is a tiny example chat to generate the test file that is indicated in the images. Running the script with the -c
flag will create the wordclouds for the chapter pages (note this is an expensive process and I thus advise you to run in without while testing on large chats).
git clone https://github.com/theveloped/WhatsBook.git
cd WhatsBook
python whatsBook.py test > content.tex
After building using pdfLaTeX
the result should look similar to this and the screenshots shown below:
This script is released under MIT License.