App Logo
linkedin.com

get_post_comments

Scrape the comments of a LinkedIn post permalink (SDUI shell): total comment count and threaded comments — urn, commenter name/headline/profile URL, posted age, text, reaction count, loaded replies nested under their parent, and a hasMoreReplies flag. `sort` mirrors the post's own dropdown: 'relevant' (LinkedIn's default — a relevance-filtered subset that hides low-engagement comments) or 'recent' (all comments, newest first — the only sort that reaches every comment). Returns up to maxComments top-level threads (default 10), wheel-scrolling to lazy-load more until the cap or the sorted view is exhausted. Older replies stay behind a countless 'See previous replies' toggle that is never driven; SDUI exposes no numeric reply count, so hasMoreReplies marks threads with unloaded replies. Long texts end at the page's own '…more' fold. English UI assumed.

Input

postUrl required

LinkedIn post permalink, e.g. https://www.linkedin.com/posts/<slug>-<id>-<code>/ or https://www.linkedin.com/feed/update/urn:li:activity:<id>/. Query string is stripped.

sort optional

Comment sort, mirroring the post's own dropdown. 'relevant' is LinkedIn's default but returns a relevance-filtered subset (low-engagement comments are hidden); 'recent' shows all comments newest-first and is the only way to reach every comment. Use 'recent' when completeness matters.

Default: "relevant"
maxComments optional

Maximum top-level comment threads to return. The script wheel-scrolls until this many are loaded or the post has no more; higher values cost proportionally more time.

Default: 10

Output

total required

Post-level comment count (includes replies). 0 when the social bar shows none.

comments required

Top-level comments in rendered order, each with its loaded replies and a hasMoreReplies flag. The page's 2-level thread: reply-to-reply is flattened by LinkedIn into the same list.

Start building for free