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")
|
print("Waiting for Facebook lock")
|
||||||
try:
|
try:
|
||||||
with open(FACEBOOK_FILE) as f:
|
with open(FACEBOOK_FILE) as f:
|
||||||
data = json.load(f)
|
return json.load(f)
|
||||||
if 'data' in data and len(data['data']) > 15:
|
|
||||||
del data['data'][14:]
|
|
||||||
else:
|
|
||||||
data = {'data': []}
|
|
||||||
return data
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("Could not find " + FACEBOOK_FILE)
|
print("Could not find " + FACEBOOK_FILE)
|
||||||
return {'data': []}
|
return {'data': []}
|
||||||
|
|
|
@ -9,9 +9,9 @@ def scrape_data():
|
||||||
for post in facebook_scraper.get_posts('amicale.deseleves', pages=3):
|
for post in facebook_scraper.get_posts('amicale.deseleves', pages=3):
|
||||||
print(post)
|
print(post)
|
||||||
cleaned_post = {
|
cleaned_post = {
|
||||||
"post_id": post["post_id"],
|
"id": post["post_id"],
|
||||||
"post_text": post["post_text"],
|
"message": post["post_text"],
|
||||||
"post_url": post["post_url"],
|
"url": post["post_url"],
|
||||||
"image": post["image"],
|
"image": post["image"],
|
||||||
"video": post["video"],
|
"video": post["video"],
|
||||||
"link": post["link"],
|
"link": post["link"],
|
||||||
|
|
Loading…
Reference in a new issue