Converts Whatsapp chat files to dictionary or save it in JSON format.
Project description
Whatsapp-Text-To-Json-Converter
Converts Whatsapp chat files to dictionary or JSON format.
Works with exports from iPhone and Android. Be sure to mention device.
Installation
pip install whatsapptojson
Using Command Line Arguments
whatsapptojson [OPTIONS]
usage: whatsapptojson [-h] -f FILE -d DEVICE [-s SAVE] [-v]
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE chat text file
-d DEVICE, --device DEVICE
can be 'iphone' or 'android'
-s SAVE, --save SAVE path of file/direction to save json, 'default' would
be same as text file name in same directory
-v, --verbose Verbose (Print output)
Using Native Python
whatsapptojson.format()
- to convert a read text to dictionary
whatsapptojson.format_file()
- to read file from text to dictionary/json
be sure to mention device
attribute correctly iphone
or android
.
from whatsapptojson import whatsapptojson
# Converting Text to Dict
output = whatsapptojson.format(text = 'string with complete chat data', device = 'android')
# Converting File to dictionary.
output = whatsapptojson.format_file(source='source_file_path', device = 'iphone')
# Converting File to dictionary.
output = whatsapptojson.format_file(source='source_file_path', device = 'iphone')
### Whatsapp File to Json.
whatsapptojson.format_file(source='source_file_path', destination='destination_path.json', device = 'android')
Sample Export
{
"attachment_extensions": [
"pdf",
"mp4",
"jpg"
],
"participants": [
"sender name 1",
"sender name 2",
"sender name n"
],
"chats": [
{
"date": "25/03/16 07:03:45 PM",
"message": "Messages to this group are now secured with end-to-end encryption.",
"type": "whatsapp meta"
},
{
"date": "15/08/17 12:27:34 PM",
"message": "message for attachment",
"sender": "sender name",
"type": "attachment",
"attachment": {
"file_name": "file_name_with.pdf",
"meta": "8 pages",
"extention": "pdf"
}
}, {
"date": "15/08/17 01:37:28 PM",
"sender": "sender name",
"message": "message",
"type": "conversation"
},
...
]
}
Each item in chats could have type of "whatsapp meta" or "attachment" or "conversation".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
whatsapptojson-1.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for whatsapptojson-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 979bc8ce1e4680a825981bc7395021dffd27007f88a656022e0fd8f1f7c6b3e5 |
|
MD5 | bce60b2494804cee983cf241396a91c1 |
|
BLAKE2b-256 | 170cfb0c4eb3812baaba4b4969dc82d60b7cf569f2695d1689938c477d64bd3e |