Spaces:
Running
Running
Update Linkedin_Data_API_Calls.py
Browse files
Linkedin_Data_API_Calls.py
CHANGED
@@ -308,7 +308,7 @@ def prepare_data_for_bubble(detailed_posts, all_actual_comments_data):
|
|
308 |
li_post_stats = []
|
309 |
li_post_comments = [] # For individual comments
|
310 |
logging.info("Preparing data for Bubble.")
|
311 |
-
|
312 |
for post_data in detailed_posts:
|
313 |
# Data for LI_post table in Bubble
|
314 |
li_posts.append({
|
@@ -320,7 +320,7 @@ def prepare_data_for_bubble(detailed_posts, all_actual_comments_data):
|
|
320 |
"sentiment": post_data["sentiment"], # Overall sentiment of the post based on its comments
|
321 |
"text": post_data["raw_text"], # Storing the full raw text
|
322 |
#"summary_text": post_data["summary"],
|
323 |
-
"li_eb_label": post_data["category"]
|
324 |
# Add any other fields from post_data needed for LI_post table
|
325 |
})
|
326 |
|
@@ -333,7 +333,8 @@ def prepare_data_for_bubble(detailed_posts, all_actual_comments_data):
|
|
333 |
"likeCount": post_data["likes"],
|
334 |
"shareCount": post_data["shares"],
|
335 |
"uniqueImpressionsCount": post_data["uniqueImpressionsCount"],
|
336 |
-
"post_id": post_data["id"] # Foreign key to LI_post
|
|
|
337 |
})
|
338 |
|
339 |
# Data for LI_post_comments table in Bubble (individual comments)
|
@@ -343,7 +344,8 @@ def prepare_data_for_bubble(detailed_posts, all_actual_comments_data):
|
|
343 |
if single_comment_text and single_comment_text.strip(): # Ensure comment text is not empty
|
344 |
li_post_comments.append({
|
345 |
"comment_text": single_comment_text,
|
346 |
-
"post_id": post_urn # Foreign key to LI_post
|
|
|
347 |
# Could add sentiment per comment here if analyzed at that granularity
|
348 |
})
|
349 |
|
|
|
308 |
li_post_stats = []
|
309 |
li_post_comments = [] # For individual comments
|
310 |
logging.info("Preparing data for Bubble.")
|
311 |
+
org_urn = detailed_posts[0]["author_urn"]
|
312 |
for post_data in detailed_posts:
|
313 |
# Data for LI_post table in Bubble
|
314 |
li_posts.append({
|
|
|
320 |
"sentiment": post_data["sentiment"], # Overall sentiment of the post based on its comments
|
321 |
"text": post_data["raw_text"], # Storing the full raw text
|
322 |
#"summary_text": post_data["summary"],
|
323 |
+
"li_eb_label": post_data["category"]
|
324 |
# Add any other fields from post_data needed for LI_post table
|
325 |
})
|
326 |
|
|
|
333 |
"likeCount": post_data["likes"],
|
334 |
"shareCount": post_data["shares"],
|
335 |
"uniqueImpressionsCount": post_data["uniqueImpressionsCount"],
|
336 |
+
"post_id": post_data["id"], # Foreign key to LI_post
|
337 |
+
"organization_urn": org_urn
|
338 |
})
|
339 |
|
340 |
# Data for LI_post_comments table in Bubble (individual comments)
|
|
|
344 |
if single_comment_text and single_comment_text.strip(): # Ensure comment text is not empty
|
345 |
li_post_comments.append({
|
346 |
"comment_text": single_comment_text,
|
347 |
+
"post_id": post_urn, # Foreign key to LI_post
|
348 |
+
"organization_urn" = org_urn
|
349 |
# Could add sentiment per comment here if analyzed at that granularity
|
350 |
})
|
351 |
|