将whatsapp聊天文件转换为字典或以json格式保存。

whatsapptojson的Python项目详细描述


WhatsApp文本到JSON转换器

将whatsapp聊天文件转换为字典或json格式。

可用于iPhone和Android的导出。一定要提到设备。

安装

pip install whatsapptojson

使用命令行参数

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)

使用本机python

whatsapptojson.format()-将已读文本转换为字典

whatsapptojson.format_file()-将文件从文本读取到字典/json

确保正确地提到device属性iphoneandroid

fromwhatsapptojsonimportwhatsapptojson# Converting Text to Dictoutput=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')

样本导出

{"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"},...]}

聊天中的每一项都可以有“WhatsApp元”或“附件”或“对话”类型。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java连接在一个屏幕上成功下载,在第二个屏幕上用几乎相同的代码获得错误   java调用super。超级的方法,跳过超级。方法   使用Web服务连接到sharepoint 2013的Java应用程序   java我无法正确呈现editText   httpurlconnection如何在java中检查url连接状态   java Spring Security可以为同一用户接受多个密码吗?   java如何在PreparedStatement中使用自动生成的@Id?   java每个数组表示一个位模式   java我不确定如何记录鼠标在某个区域被点击的次数   spring如何解决:java。lang.NoSuchMethodError:javax。坚持不懈实体管理器。createStoredProcedureQuery(Ljava/lang/String;)   java如何为blackberry中listfield项内的不同字段触发事件   安卓使用Proguard混淆java代码   java在grails 2中与多个数据源有一个和一个域关联。十、   java在尝试在单击按钮时返回combobox值时一直出错   java我可以在setter中使用@Resource注释而不是字段吗?   java Eclipse调试步进不工作   java比较相同对象的两个表并选择不同的表