Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to get social reactions for a post. #264

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

kjoconnor
Copy link
Contributor

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

Copy link

@adgsenpai adgsenpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rkildea1
Copy link

rkildea1 commented May 1, 2023

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

@tomquirk
Copy link
Owner

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

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

@merlinrabens
Copy link

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

@tomquirk
Copy link
Owner

Let's merge this thing! Thanks @kjoconnor for the contribution, I added a test and it works perfectly.

cc @adgsenpai @merlinrabens @rkildea1

@tomquirk tomquirk self-requested a review August 27, 2024 22:14
@philipforget
Copy link

Thanks @kjoconnor !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants