GuglielmoTor commited on
Commit
2166780
·
verified ·
1 Parent(s): f5113bb

Update Linkedin_Data_API_Calls.py

Browse files
Files changed (1) hide show
  1. Linkedin_Data_API_Calls.py +4 -4
Linkedin_Data_API_Calls.py CHANGED
@@ -114,7 +114,7 @@ def fetch_linkedin_posts_core(comm_client_id, community_token, org_urn, count=20
114
  "published_at_timestamp": timestamp,
115
  "published_at_iso": published_at_iso,
116
  # These are placeholders for actual fields from LinkedIn API response. Verify field names.
117
- "author_urn": p.get("author", "urn:li:unknown"), # e.g., "urn:li:person:xxxx" or "urn:li:organization:xxxx"
118
  "is_ad": p.get("is_ad", False) # LinkedIn might use a different field like 'sponsored' or 'promoted'
119
  #"media_type": p.get("mediaCategory", "NONE") # e.g., ARTICLE, IMAGE, VIDEO, NONE
120
  })
@@ -289,7 +289,7 @@ def compile_detailed_posts(processed_raw_posts, stats_map, sentiments_per_post):
289
  "sentiment_details": sentiment_info.get("details", {}), # Detailed counts
290
  "summary": proc_post["summary"],
291
  "category": proc_post["category"],
292
- "author_urn": proc_post["author_urn"],
293
  "is_ad": proc_post["is_ad"],
294
  #"media_type": proc_post["media_type"],
295
  "published_at": proc_post["published_at_iso"] # ISO format datetime string
@@ -308,11 +308,11 @@ 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
- 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({
315
- "author_urn": post_data["author_urn"],
316
  "id": post_data["id"], # Post URN
317
  "is_ad": post_data["is_ad"],
318
  #"media_type": post_data["media_type"],
 
114
  "published_at_timestamp": timestamp,
115
  "published_at_iso": published_at_iso,
116
  # These are placeholders for actual fields from LinkedIn API response. Verify field names.
117
+ "organization_urn": p.get("author", "urn:li:unknown"), # e.g., "urn:li:person:xxxx" or "urn:li:organization:xxxx"
118
  "is_ad": p.get("is_ad", False) # LinkedIn might use a different field like 'sponsored' or 'promoted'
119
  #"media_type": p.get("mediaCategory", "NONE") # e.g., ARTICLE, IMAGE, VIDEO, NONE
120
  })
 
289
  "sentiment_details": sentiment_info.get("details", {}), # Detailed counts
290
  "summary": proc_post["summary"],
291
  "category": proc_post["category"],
292
+ "organization_urn": proc_post["organization_urn"],
293
  "is_ad": proc_post["is_ad"],
294
  #"media_type": proc_post["media_type"],
295
  "published_at": proc_post["published_at_iso"] # ISO format datetime string
 
308
  li_post_stats = []
309
  li_post_comments = [] # For individual comments
310
  logging.info("Preparing data for Bubble.")
311
+ org_urn = detailed_posts[0]["organization_urn"]
312
  for post_data in detailed_posts:
313
  # Data for LI_post table in Bubble
314
  li_posts.append({
315
+ "organization_urn": post_data["organization_urn"],
316
  "id": post_data["id"], # Post URN
317
  "is_ad": post_data["is_ad"],
318
  #"media_type": post_data["media_type"],