linkedin-api
linkedin-api copied to clipboard
Add method to get social reactions for a post.
This shows likes, etc. for a post.
In [2]: from linkedin_api import Linkedin
In [3]: api = Linkedin(USERNAME, PASSWORD)
In [4]: reactions = api.get_social_reactions("urn:li:activity:6975230311307644928", max_results=10)
In [5]: reactions[0]
{'actor': {'profileUrn': {'entityUrn': 'urn:li:fsd_profile:ACoAABO7kRoBn-gddYTjVljt4Ox54a6jjuE-5pc',
...
people still looking for this can use the main branch
e.g.,
recent_posts = api.get_company_updates('google')
post_record = recent_posts[0] #get the most recent post only
dict_of_reactions = post_record['value']['com.linkedin.voyager.feed.render.UpdateV2']['socialDetail']['totalSocialActivityCounts']['reactionTypeCounts']
The output would be:
[{'count': 1274, 'reactionType': 'LIKE'},
{'count': 49, 'reactionType': 'INTEREST'},
{'count': 29, 'reactionType': 'EMPATHY'},
{'count': 8, 'reactionType': 'PRAISE'},
{'count': 2, 'reactionType': 'APPRECIATION'}]
Also,:
number_of_comments = post_record['value']['com.linkedin.voyager.feed.render.UpdateV2']['socialDetail']['totalSocialActivityCounts']['numComments']
number_of_shares = post_record['value']['com.linkedin.voyager.feed.render.UpdateV2']['socialDetail']['totalSocialActivityCounts']['numShares']
@kjoconnor thanks for this contribution and sorry for the massive delay!
Could you confirm it still works? If it does, lets merge 🙏
@tomquirk Hey Tom, could we merge this please? This would be a FANTASTIC addition.