blob: c7238e042de55bb852f87719be65983e0573253b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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))
|