No Partying Mariachis


    0.0.2 • Public • Published

    Tool for extracting information out of

    Facebook appearently allows you to download your data in a .zip-file (try it here). Sadly, the files are in HTML and are meant to be viewed in a web browser; the raw data is hard to consume. Then, this repository happened.

    fb-extract is a CLI that extracts your facebook data (messages) from HTML into JSON/CSV. Using this tool, you get the power to do whatever you want with your precious data. Word completetion, a chatbot that uses your expressions, machine learning etc. Endless possibilities! With your own data! Yay!

    Anyhow, my conversion is probably not perfect. If you feel like something is lost in the conversion, file up an issue.

    These platforms/databases/languages are tested so far:

    • Linux/PostgreSQL/Swedish

    I have no idea if this tool works at all with any language other than Swedish, and I have currently no way of testing that. As such, PR are very welcome :)

    NOTE! Your language has to be in this repository to convert timestamps correctly. The timestamps looks like "den 10 november 2013 kl. 10:18 UTC+01" and are thus impossible to convert without a locale. If your language isn't supported, timestamps will be recorded as null.


    npm i -g fb-extract


    Unzip that you downloaded from here, then run fb-extract /path/to/facebook_dir.

    The tool will now ask you for your language the first time you run it. This is to make sure that timestamps are converted properly. The config is stored in ~/.config/fb-extract-nodejs/config.json. If interrupted, the tool restarts at where it left off by scanning the JSON-dir.

    Converting long conversations takes quite a long time compared to short ones. Go ahead and take a coffee or two.

    The tool creates two new folders in /path/to/facebook_dir

    ├── csv
    └── json

    where files are placed accordingly.

    If you wan't to play around with TensorFlow, you're all set. Just use the csv-files.

    If you wan't to have your messages in your database however, you should run psql < csv/import.sql (or execute csv/import.sql in some way on your database)


    Columns in italics indicate a foreign key referencing another table key.


    Column Type
    cid serial
    chat_name text


    Column Type
    mid serial
    cid integer
    uid integer
    content text
    media text
    timestamp timestamp without time zone


    Column Type
    pid serial
    uid integer
    cid integer


    Column Type
    uid serial
    name text


    Column Type
    rid serial
    mid integer
    uid integer
    emoji integer

    Example queries

    Found under examples/




    npm i fb-extract

    DownloadsWeekly Downloads






    Unpacked Size

    16.6 kB

    Total Files


    Last publish


    • mryakobo