summaryrefslogtreecommitdiff
path: root/bin/get-fb-content.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/get-fb-content.py')
-rw-r--r--bin/get-fb-content.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/get-fb-content.py b/bin/get-fb-content.py
new file mode 100644
index 0000000..c7238e0
--- /dev/null
+++ b/bin/get-fb-content.py
@@ -0,0 +1,19 @@
+import json
+import logging
+import sys
+from os import path
+
+from facebook_scraper import get_posts
+
+
+BASEDIR = path.dirname(__file__)
+
+posts = []
+for post in get_posts(sys.argv[1], cookies=path.join(BASEDIR, '../config/facebook.com_cookies.txt'), pages=3):
+ posts.append({
+ 'id': post['post_id'],
+ 'time': str(post['time']),
+ 'texts': [t.strip() for t in post['text'].split('\n') if t]
+ })
+
+print(json.dumps(posts))