diff options
author | emkael <emkael@tlen.pl> | 2021-04-02 03:06:56 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2021-04-02 03:06:56 +0200 |
commit | 24bd87bcaf315c761f85dc898fcaf9a715b630c4 (patch) | |
tree | 06d47e54410feeefb5c38cd95eb93d0ae3bb2ff0 /bin | |
parent | 2bb2ae4c54beba67e7c63a02c7509182379589d9 (diff) |
Using an external (Python...) library to fetch FB posts
Obligatory "Fuck you, Zuckerberg"
Diffstat (limited to 'bin')
-rw-r--r-- | bin/get-fb-content.py | 19 |
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)) |