Fix dashboard news feed
This commit is contained in:
parent
5eb7bcf7b4
commit
77c4bb01d8
2 changed files with 4 additions and 9 deletions
|
@ -30,12 +30,7 @@ def get_news_feed():
|
|||
print("Waiting for Facebook lock")
|
||||
try:
|
||||
with open(FACEBOOK_FILE) as f:
|
||||
data = json.load(f)
|
||||
if 'data' in data and len(data['data']) > 15:
|
||||
del data['data'][14:]
|
||||
else:
|
||||
data = {'data': []}
|
||||
return data
|
||||
return json.load(f)
|
||||
except FileNotFoundError:
|
||||
print("Could not find " + FACEBOOK_FILE)
|
||||
return {'data': []}
|
||||
|
|
|
@ -9,9 +9,9 @@ def scrape_data():
|
|||
for post in facebook_scraper.get_posts('amicale.deseleves', pages=3):
|
||||
print(post)
|
||||
cleaned_post = {
|
||||
"post_id": post["post_id"],
|
||||
"post_text": post["post_text"],
|
||||
"post_url": post["post_url"],
|
||||
"id": post["post_id"],
|
||||
"message": post["post_text"],
|
||||
"url": post["post_url"],
|
||||
"image": post["image"],
|
||||
"video": post["video"],
|
||||
"link": post["link"],
|
||||
|
|
Loading…
Reference in a new issue