0.0.2 • Published 6 years ago

fb-extract v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Tool for extracting information out of facebook.zip

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.

Installation

npm i -g fb-extract

Usage

Unzip facebook.zip 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)

Tables

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

chats

ColumnType
cidserial
chat_nametext

messages

ColumnType
midserial
cidinteger
uidinteger
contenttext
mediatext
timestamptimestamp without time zone

participants

ColumnType
pidserial
uidinteger
cidinteger

users

ColumnType
uidserial
nametext

reactions

ColumnType
ridserial
midinteger
uidinteger
emojiinteger

Example queries

Found under examples/

License

MIT