linkedin-api icon indicating copy to clipboard operation
linkedin-api copied to clipboard

Add method to get social reactions for a post.

Open kjoconnor opened this issue 3 years ago • 2 comments

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',
...

kjoconnor avatar Nov 11 '22 04:11 kjoconnor

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']

rkildea1 avatar May 01 '23 10:05 rkildea1

@kjoconnor thanks for this contribution and sorry for the massive delay!

Could you confirm it still works? If it does, lets merge 🙏

tomquirk avatar Mar 14 '24 11:03 tomquirk

@tomquirk Hey Tom, could we merge this please? This would be a FANTASTIC addition.

merlinrabens avatar Jul 24 '24 11:07 merlinrabens