joweich / chat-miner

Parsers and visualizations for chats
MIT License
566 stars 56 forks source link

Messenger vizualization failed #139

Open 4zjata opened 1 month ago

4zjata commented 1 month ago
C:\Users\Szymon\Downloads\chat-miner-0.5.3\chatminer>python3 test.py
04.07.2024 09:11:54 INFO
            Depending on the platform, the message format in chat logs might not be
            standardized across devices/versions/localization and might change over
            time. Please report issues including your message format via GitHub.

04.07.2024 09:11:54 INFO     Initialized parser.
04.07.2024 09:11:54 INFO     Starting reading raw messages...
04.07.2024 09:11:54 INFO     Finished reading 1886 raw messages.
04.07.2024 09:11:54 INFO     Starting parsing raw messages...
  0%|                                                                                         | 0/1886 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\Szymon\Downloads\chat-miner-0.5.3\chatminer\test.py", line 9, in <module>
    parser.parse_file()
  File "C:\Users\Szymon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\chatminer\chatparsers.py", line 97, in parse_file
    self._parse_raw_messages()
  File "C:\Users\Szymon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\chatminer\chatparsers.py", line 106, in _parse_raw_messages
    parsed_mess = self._parse_message(raw_mess)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Szymon\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\chatminer\chatparsers.py", line 212, in _parse_message
    time = dt.datetime.utcfromtimestamp(mess["timestamp_ms"] / 1000)
                                        ~~~~^^^^^^^^^^^^^^^^
KeyError: 'timestamp_ms'

I dont know how to include format, all i know is that was a .json file from messenger website

joweich commented 1 month ago

Hey @4zjata, thank you for opening this issue! It seems like your export json file does not have a timestamp_ms field. Our parser expects this format:

{
  "messages": [
    {
      "sender_name": "John Doe",
      "timestamp_ms": 1579294140000,
      "content": "Hello Jane!"
    },
    {
      "sender_name": "Jane Doe",
      "timestamp_ms": 1577186580000,
      "content": "Hello John!"
    }
  ]
}

For further investigation, we'd need to have (anonymized) snippet of your json file. You can open the file with any text editor such as VS Code. Would you mind providing this? Thank you! :hugs: