Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mazen160/whatsapp-chat-parser
WhatsApp Chat Parser
https://github.com/mazen160/whatsapp-chat-parser
whatsapp whatsapp-chat whatsapp-chat-parser
Last synced: 2 days ago
JSON representation
WhatsApp Chat Parser
- Host: GitHub
- URL: https://github.com/mazen160/whatsapp-chat-parser
- Owner: mazen160
- License: mit
- Created: 2020-05-31T14:55:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-24T19:00:37.000Z (over 1 year ago)
- Last Synced: 2024-09-20T20:02:09.907Z (6 days ago)
- Topics: whatsapp, whatsapp-chat, whatsapp-chat-parser
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 18
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# whatsapp-chat-parser
## A module to parse WhatsApp chats
# Use-Cases?
- Analysis of WhatsApp messages for different domain-specific motives.
- Processing WhatsApp messages.
- Having an interface for reading raw WhatsApp chat exports.# Usage
### Installing module
```shell
python3 setup.py install
```### Running the module
```python
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)
```# API
```python
>>> 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.
```# Examples
The `./examples` directory has CLI examples.```python
$ 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
$ python get_author_count.py
25000 --> X
30 --> Y
1 --> Z
```# Exporting Chats
Exporting chats is done from the WhatsApp app. You can follow WhatsApp documentation for the details.
[https://faq.whatsapp.com/en/android/23756533/](https://faq.whatsapp.com/en/android/23756533/).
# Requirements
- Python 3
# License
The project is licensed under MIT License.# Author
*Mazin Ahmed*
* Website: [https://mazinahmed.net](https://mazinahmed.net)
* Email: *mazin [at] mazinahmed [dot] net*
* Twitter: [https://twitter.com/mazen160](https://twitter.com/mazen160)
* Linkedin: [http://linkedin.com/in/infosecmazinahmed](http://linkedin.com/in/infosecmazinahmed)