tomquirk / linkedin-api

👨‍💼 LinkedIn API for Python
https://pypi.org/project/linkedin-api
MIT License
2.05k stars 448 forks source link

Get comments and reactions from profile posts #183

Open alvaroserrrano opened 3 years ago

alvaroserrrano commented 3 years ago

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.

abinpaul1 commented 3 years ago

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.

alvaroserrrano commented 3 years ago

I am guessing 3A6849596184437276672 is the activity urn?

abinpaul1 commented 3 years ago

Yeah I guess so. The urn id of the post

alvaroserrrano commented 3 years ago

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

alvaroserrrano commented 3 years ago

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 commented 3 years ago

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.

abinpaul1 commented 3 years ago

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 commented 2 years ago

Fetching comments for post added in #185.

kyrylogy commented 1 year ago

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