0.1.3 • Published 5 years ago

facebook-chat-downloader v0.1.3

Weekly downloads
1
License
MIT+uuid
Repository
github
Last release
5 years ago

Description

facebook-chat-downloader is an unofficial facebook chat messages downloader command line utility.
It's designed to simplify the retrieval of the chat messages of a list of users.
It uses facebook-chat-api library to retrieve the data from facebook.

facebook-chat-downloader can login from an email and password from command line options, user prompt, or from a state-file (generated if requested after the first successful login), allowing to connect multiple times without requesting multiple times the email/password.

The file storage is done per chat name, usually the username, where the filename is the chat name with the symbols removed, supporting the following file formats:

  • raw json - the data is stored as it's retrieved from the facebook-chat-api.
  • formatted json - the output is processed, according to the supplied field names.
  • txt - a text file with one message per line.

Installation

[sudo] npm install -g facebook-chat-downloader

Usage

facebook-chat-downloader [options]

Where the options are:

Short NameLong NameDescription
-e--emailemailif email and input state file aren't present, it will request by user prompt
-p--passwordpasswordif password and input state file aren't present, it will request by user prompt
-s--state-filestate filenameif -S isn't present, it will read state from this filereplacing the need of an email and password
-S--write-state-fileif present, it will write the state to this file after successful login
-t--threads-filechat threads filenameif -T isn't present, it will read threads from this filereplacing the need of an extra request
-T--write-threads-fileif present, it will write the threads file
-l--limitmaximum number of chat threadsuse this value, only if the chats to download are recent
-g--taglist of chat types by tagsPossible values are INBOX,ARCHIVED,PENDING,OTHER
-n--chat-namelist of chat names to download
-R--rawif present and output is in raw json, otherwise is in formatted json
-O--output-folderoutput folderlocation where all the chat files will be stored
-N--output-field-namelist of fields names for non-raw storagePossible values are: date, sender, message
-F--output-file-formatoutput file format. Either txt or json
-D--output-date-formatoutput date-time format. see moment.js
-c--convertconverts from raw chat file into another formatIf it's present, it will bypass login,and it will read from previously stored raw json files

Examples

facebook-chat-downloader -n 'My lunch group' -n 'Miss 王' -R

It will prompt for the email and password associated with your facebook account,
and store the chats in the files: my-lunch-group.raw.json and miss-王.raw.json.

facebook-chat-downloader -e myfbemail@northpole.com -s state.json -S -O chats

It will prompt for the password, store the state in state.json after successful login,
and store all the chats in the folder chats in json format.

facebook-chat-downloader -s state.json -t threads.json -T -n 'Hiking (weekend)' -F txt

It will read the login from state.json, write the thead list in threads.json,
download one chat and store it in text format on the file hiking-weekend.txt.

facebook-chat-downloader -t threads.json -c -n 'My lunch group' -F txt -N date -N message -N sender

It will read the previously stored my-lunch-group.raw.json and convert it into text format,
with the message before the sender.

Caveats

To prevent connection timeouts, facebook-chat-downloader downloads a 50 messages package, and then it uses a recursive function to retrieve the next one package. If a certain chat has too many messages, it could reach a stack overflow.

License

MIT License+uuid License

Copyrights

(c) 2018 Alexandre Bento Freire