- Analysis of WhatsApp messages for different domain-specific motives.
- Processing WhatsApp messages.
- Having an interface for reading raw WhatsApp chat exports.
python3 setup.py install
from whatsapp_chat_parser import get_messages
messages = get_messages("chat.txt")
for message in messages["chats"]:
print(message["author"])
print(message["message"])
print(message["timestamp"])
for descriptive_message in messages["descriptive_messages"]:
print(descriptive_message)
>>> messages = whatsapp_chat_parser.get_messages("chat.txt") # Parameters: path of the chat txt file, and an optional (date_format) string (default date_format: [%d/%m/%Y, %H:%M:%S])
>>> messages["chats"] # Chats, ordered by timestamp.
>>> for message in messages["chats"]:
>>> message["chats"]["timestamp"] # Timestamp in datetime
>>> message["chats"]["original_date"] # Original timestamp
>>> message["chats"]["message"] # Message
>>> message["chats"]["Author"] # Author
>>> message["descriptive_messages"] # List of descriptive messages that was sent by WhatsApp, ordered by timestamp.
The ./examples
directory has CLI examples.
$ python parse_chat.py
-::: parse-chat.py (for whatsapp-chat-parser) :::-
-::: by: Mazin Ahmed (mazin[at]mazinahmed.net) :::-
Usage parse_chat.py [_chat.txt]
$ python get_author_count.py
25000 --> X
30 --> Y
1 --> Z
Exporting chats is done from the WhatsApp app. You can follow WhatsApp documentation for the details.
https://faq.whatsapp.com/en/android/23756533/.
- Python 3
The project is licensed under MIT License.
Mazin Ahmed
- Website: https://mazinahmed.net
- Email: mazin [at] mazinahmed [dot] net
- Twitter: https://twitter.com/mazen160
- Linkedin: http://linkedin.com/in/infosecmazinahmed