Social Networks Scripts

Facebook comments extraction

Description

Comments Edge. When read with a User access token, the /comments edge returns empty data for the following nodes: Album, Photo, Post, Video

However, you may occasionally need to extract and archive a particular conversation taking place in the comments of a Facebook post.

The python script facebook-comments.py parses the html page of the post to extract the comments, without using the dedicated Python libraries requiring authentication.

How to export the HTML page

Preliminary steps to save the file post.html:

  1. Click on the post you want to extract comments
  2. Expand all comments
  3. Save as HTML page

Usage

python facebook-comments.py -i post.html > comments.txt
                                  [--dialogue True]
Optional argument: 
  --d, dialogue DIALOGUE   Format text comments to fit the Dialogue Obsidian Plugin if DIALOGUE=True

The optional argument --dialogue True adds some symbols before author names and paragraphs to be compatible with the syntax of Obsidian Dialogue plugin.