Facebook JSON Message Parser and MongoDB Uploader
Project description
README
Why should you use this?
When you export your personal data from Facebook/Instagram, you will see that the encoding of the .json messages is not human-readable. This script combines and decodes the messages to a human-friendly format, making it easier to read and understand your message history.
Installation
To run this script, you will need Python 3.6 or higher and the tqdm library installed. You can install the tqdm library by running the following command in your terminal:
pip install tqdm
Usage
-
To extract your personal data from Facebook or Instagram, log in to your account and go to the settings page. From there, select "Download Your Information" and follow the prompts to generate a data file. Extract the messages folder from the downloaded data by navigating to the Messages folder within the data file and copying it to a separate location.
-
Download this repository.
-
Create in/ folder in the root of the repository.
-
Copy the message_x.json files you want to decode to the in/ folder located in the root of the repository. Ideally, only one chat thread should be copied at a time.
-
Create an out/ folder in the same location as the in/ folder.
-
Run the decoder_py script from the repository. This script should be able to decode the message_x.json files located in the in/ folder and output the decoded messages as one file in the out/ folder.
-
Repeat the process by copying another conversation file into the in/ folder and running the decoder_py script to decode the messages.
How does it work
The decoder_py script uses three functions to combine, decode, and write the messages to separate files.
combine_and_convert_json_files
This function combines multiple JSON files into one, converts the timestamp_ms field in each message to a human-readable format, sorts the messages by timestamp, and writes the updated JSON file to the out/ folder.
batch_decoder.py
This script reads the combined and decoded .json file in the out/ folder, and writes each message to a separate file in the out/decoded/ folder. It first calculates the total number of messages in the input file and updates the progress bar accordingly. Then, it loads the messages, decodes special characters, and writes each message to an output file.
FacebookIO
The FacebookIO class is used to decode special characters in the JSON messages. It extends the io.FileIO class and overrides the read method to replace Unicode escape sequences with actual characters.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file facebook_json_message_data_parser_public-1.1.0.tar.gz.
File metadata
- Download URL: facebook_json_message_data_parser_public-1.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e29db4abc32044905b92f2e6b6c6fce02cfb4e83240cbc300e1cc0567919e495
|
|
| MD5 |
4db26cb065dac918e88810088f4156ee
|
|
| BLAKE2b-256 |
3d71d3a8508d04c87d2d2db842dca134b2033eed78f695a9955f411317ed3dd1
|
File details
Details for the file facebook_json_message_data_parser_public-1.1.0-py3-none-any.whl.
File metadata
- Download URL: facebook_json_message_data_parser_public-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70c866068bf30ef775c0a5205f8dd59e06fc70fe365e561d49dc000cd243b8eb
|
|
| MD5 |
c80e325cb868e092e1a354b4cf3864ef
|
|
| BLAKE2b-256 |
e394a68b03a6ba389e11e255611a8caa2d081c24a95f4b02cb1ee208973d6aa0
|