Giter Site home page Giter Site logo

whatsbook's Introduction

WhatsBook | WhatsApp chat parser for print using LaTeX

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.

WhatsBook a photo book styled chat archive

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

Usage

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.

Test

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:

Page 1 Page 2 Page 3

License

This script is released under MIT License.

whatsbook's People

Contributors

habi avatar theveloped avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

whatsbook's Issues

AttributeError: 'NoneType' object has no attribute 'upper'

When running python3 whatsBook.py ExportedChat > content.tex fails with the following error:

Traceback (most recent call last):
  File "whatsBook.py", line 385, in <module>
    main()
  File "whatsBook.py", line 78, in main
    for line in parsedChat:
  File "whatsBook.py", line 317, in parseChat
    img = drawMonth(img, prevMonth, mask=False)
  File "whatsBook.py", line 325, in drawMonth
    width, height = draw.textsize(month.upper(), font)
AttributeError: 'NoneType' object has no attribute 'upper'

ValueError: not enough values to unpack (expected 3, got 1)

Whe I try to run the script on one of my exports, I get the error

ValueError: not enough values to unpack (expected 3, got 1)

The full Traceback is

[habi@anomalocaris|WhatsBook]:python whatsBook.py folder/ > content.tex 
Traceback (most recent call last):
  File "whatsBook.py", line 385, in <module>
    main()
  File "whatsBook.py", line 78, in main
    for line in parsedChat:
  File "whatsBook.py", line 238, in parseChat
    parsedDate, month = parseDate(date)
  File "whatsBook.py", line 372, in parseDate
    day, month, year = re.split("[-/]", dateString, 2)
ValueError: not enough values to unpack (expected 3, got 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.