Spaces:
Paused
Paused
Update func_facebook.py
Browse files- func_facebook.py +13 -2
func_facebook.py
CHANGED
@@ -12,8 +12,19 @@ def hide_negative_comments(token):
|
|
12 |
|
13 |
def get_facebook_posts():
|
14 |
graph = init_facebook_client(token)
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
|
|
|
12 |
|
13 |
def get_facebook_posts():
|
14 |
graph = init_facebook_client(token)
|
15 |
+
|
16 |
+
# Fetching user posts
|
17 |
+
user_posts_data = graph.get_object(id='me/posts', fields='id,message,created_time')
|
18 |
+
user_posts = user_posts_data.get('data', [])
|
19 |
+
|
20 |
+
# Fetching ads posts
|
21 |
+
ads_posts_data = graph.get_object(id='me/ads_posts', fields='id,message,created_time')
|
22 |
+
ads_posts = ads_posts_data.get('data', [])
|
23 |
+
|
24 |
+
# Combine the posts from both sources
|
25 |
+
all_posts = user_posts + ads_posts
|
26 |
+
|
27 |
+
return all_posts
|
28 |
|
29 |
|
30 |
|