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

Get comments and reactions from profile posts

Open alvaroserrrano opened this issue 3 years ago • 9 comments

I am starting a new issue for this since the get_profile_posts feature discussed here on Pull Request 181 returns the actual feed of the profile's activity and, therefore, we cannot populate the comments and reactions data structures. The reason for that is that Linkedin only shows the counts and maybe a few comments in the feed.

alvaroserrrano avatar Oct 05 '21 00:10 alvaroserrrano

I saw the following endpoint to get reactions

https://www.linkedin.com/voyager/api/voyagerSocialDashReactions?decorationId=com.linkedin.voyager.dash.deco.social.ReactionsByType-13&count=10&q=reactionType&start=20&threadUrn=urn%3Ali%3Aactivity%3A6849596184437276672"

and following for comments

https://www.linkedin.com/voyager/api/feed/comments?count=10&paginationToken=657919586-1633431171670-fdc0c676586f611a2dcda58b39c300d3&q=comments&sortOrder=RELEVANCE&start=20&updateId=activity%3A6849596184437276672

The comments endpoint makes use of pagination token as well, most probably similar manner to the posts feed. Feel free to investigate further

You could try finding endpoints on your own. Navigate to linkedin with Developer tools open in Chrome. In the network tab, try filter as '/voyager' and you can see the endpoints and the body of the request being sent and the response as well.

abinpaul1 avatar Oct 05 '21 11:10 abinpaul1

I am guessing 3A6849596184437276672 is the activity urn?

alvaroserrrano avatar Oct 05 '21 13:10 alvaroserrrano

Yeah I guess so. The urn id of the post

abinpaul1 avatar Oct 05 '21 13:10 abinpaul1

I started a PR for the comments https://github.com/tomquirk/linkedin-api/pull/184/.

alvaroserrrano avatar Oct 11 '21 17:10 alvaroserrrano

The above PR's code currently returns no data. This is a simple python print of the first after calling the url listed below and the json data returned.

https://www.linkedin.com/voyager/api/feed/comments?count=100&start=0&q=comments&sortOrder=RELEVANCE&updateId=activity%3A6849596184437276672

{'metadata': {}, 'elements': [], 'paging': {'count': 100, 'start': 0, 'total': 0, 'links': []}}

alvaroserrrano avatar Oct 11 '21 20:10 alvaroserrrano

New PR https://github.com/tomquirk/linkedin-api/pull/185 but I still have not figured out why those commit messages keep appearing.

I ran git checkout master git fetch upstream git merge upstream/master and then I created the feature branch. I will need help cleaning this mess up.

I will work on making the get_posts_comments more reusable passing the post_urn that we want to get comments for.

alvaroserrrano avatar Oct 13 '21 22:10 alvaroserrrano

I think an easier workflow would be to do just checkout master and do a git pull. Then to do your work switch to a new branch using git checkout -b new_private_branch_name. Its best to make sure you dont do any commits or merge commits directly on master because then it will be inconsistent.

abinpaul1 avatar Oct 14 '21 04:10 abinpaul1

Fetching comments for post added in #185.

abinpaul1 avatar Nov 12 '21 01:11 abinpaul1

Hi, did you stumble upon any endpoint to write a comment under a post by any chance? This issue can be closed I guess

kyrylogy avatar Feb 12 '23 17:02 kyrylogy