Skip to main content

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

  1. 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.

  2. Download this repository.

  3. Create in/ folder in the root of the repository.

  4. 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.

  5. Create an out/ folder in the same location as the in/ folder.

  6. 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.

  7. 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


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file facebook_json_message_data_parser_public-1.1.0.tar.gz.

File metadata

File hashes

Hashes for facebook_json_message_data_parser_public-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e29db4abc32044905b92f2e6b6c6fce02cfb4e83240cbc300e1cc0567919e495
MD5 4db26cb065dac918e88810088f4156ee
BLAKE2b-256 3d71d3a8508d04c87d2d2db842dca134b2033eed78f695a9955f411317ed3dd1

See more details on using hashes here.

File details

Details for the file facebook_json_message_data_parser_public-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for facebook_json_message_data_parser_public-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70c866068bf30ef775c0a5205f8dd59e06fc70fe365e561d49dc000cd243b8eb
MD5 c80e325cb868e092e1a354b4cf3864ef
BLAKE2b-256 e394a68b03a6ba389e11e255611a8caa2d081c24a95f4b02cb1ee208973d6aa0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page