How to Scrape LinkedIn Comments (2026)
- LinkedIn has no free public endpoint that returns a post's commenters. A logged-out fetch of a post returns HTTP 200 but a sign-in wall, with none of the comment nodes in the HTML.
- The DIY route is a logged-in Selenium session that opens the post, clicks
Load more commentsuntil the thread is fully expanded, then parses each commenter's name, headline, profile URL, and comment text. - LinkedIn's obfuscated markup and the informal ~50-posts-per-day account ceiling break the DIY route at scale, so for volume I send the post URL to a scraper API that returns comments as parsed JSON.
- Comment data is personal data under the GDPR, and LinkedIn's User Agreement forbids scraping, so stay on public posts. hiQ v. LinkedIn keeps public-data scraping defensible in the US.
I tried to scrape LinkedIn comments the direct way first: one requests.get on a public post, then read the commenters out of the HTML. The status code came back 200, but the comments were not there. LinkedIn served a sign-in wall where the thread should have been, which is the first thing you learn about how to scrape LinkedIn comments: the data is not in the page you get back without a login.
This guide is what I ran in July 2026 against live LinkedIn posts. It covers the logged-out response you actually get, the Python and Selenium route that does return comment threads, the account limits that break it, and the scraper API I reach for when I need commenters at volume. Every code sample is real, and where a route is walled I show the exact signal so you can spot it in your own logs.
Can you scrape LinkedIn comments?
You can scrape LinkedIn comments, but not from the page a logged-out request returns and not through a free public API. LinkedIn exposes no open endpoint that hands you the list of people who commented on a post, and the logged-out post page serves a “sign in to continue” shell instead of the thread. So the question splits into which surface actually carries the comment data, and every one of them has a catch.
Here are the four routes and what each returns, which I measured or confirmed directly:
| Route | Login needed | Returns comments? | Catch |
|---|---|---|---|
requests on the post URL, logged out | No | No | HTTP 200, sign-in wall, no comment nodes in the HTML |
| Selenium logged-in session | Yes, your account | Yes | Loads and paginates the thread, but counts against your account |
| Official Comments API | OAuth + Partner Program | Limited | Only content your own app or organization manages |
| Scraper API | No, managed | Yes | Parsed JSON, proxies and login handled server-side |
The logged-out failure is worth seeing once so you recognize it. When I fetched a public post with a real Chrome User-Agent, I got HTTP 200 and a full page, but the comment thread was not in it:
import requests
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36"
post_url = "https://www.linkedin.com/posts/williamhgates_example-activity-7200000000000000000-abcd"
r = requests.get(post_url, headers={"User-Agent": ua}, timeout=20)
print(r.status_code) # -> 200
html = r.text.lower()
print("sign in" in html) # -> True (authwall shell)
print("comments-comment-item" in html) # -> False (no comment nodes to parse)
The official route exists but does not solve the common case. LinkedIn’s Comments API reads and writes comments on shares and returns nested replies through a parent comment URN, but it lives inside the Community Management product and is gated behind Partner Program approval. It is built for managing engagement on your own organization’s posts, not for pulling the commenters on someone else’s viral thread. That gap between the walled page and the gated API is the whole reason a comment scrape is its own task, and it starts with knowing what a comment actually contains.
What data can you extract from a LinkedIn comment?
A LinkedIn comment carries far more than its text, because each comment is a named person with a headline and a profile link attached. That is what makes comment data worth extracting for outreach and research, and it is also what makes it personal data you have to handle carefully. When you scrape a post’s thread, these are the fields worth capturing per comment:
- Commenter name and headline: the person’s display name and their current role or tagline, the fields that qualify whether they fit your audience.
- Profile URL: the stable
/in/link, the key you use to dedupe commenters and to enrich them later. - Comment text: the full comment body, which is the intent signal itself and often the reason the person is a warmer lead than a cold search result.
- Reactions and timestamp: the like count on the comment and when it was posted, useful for ranking the most engaged voices on a thread.
- Nested replies: the replies under a top-level comment, kept in order beneath their parent so a conversation stays readable.
That reply nesting is where cheap tools tend to fail, flattening threaded replies into one undifferentiated list. The privacy point is not optional either. Because every comment names a real person, comment data is personal data under the GDPR, and in December 2024 the French regulator CNIL fined KASPR 240,000 euros for collecting LinkedIn contact data from members who had limited their visibility. Keep collection to genuinely public posts and honor opt-outs. With the target fields defined, the next question is how to pull them with code.
How do you scrape LinkedIn comments with Python?
You scrape LinkedIn comments with Python by driving a logged-in browser session with Selenium, loading the post, expanding the full thread, and parsing each comment out of the rendered DOM. Plain requests will not work here, because the comment nodes only appear after an authenticated session loads the page and runs its JavaScript. The most-referenced open-source example is gurbaaz27/linkedin-comments-scraper, a Selenium script that takes a post URL and writes each commenter’s name, designation, profile link, and comment text to CSV.
One setup detail keeps the account safer: log in by hand once and reuse the saved cookies, rather than automating the login form, which is what usually trips the CAPTCHA. From there you open the post and read the thread:
import json, time
from selenium import webdriver
from selenium.webdriver.common.by import By
POST_URL = "https://www.linkedin.com/posts/williamhgates_example-activity-7200000000000000000-abcd"
driver = webdriver.Chrome()
# Reuse a session you logged into by hand. Automating the login form
# is what trips the CAPTCHA, so load saved cookies instead.
driver.get("https://www.linkedin.com")
for cookie in json.load(open("li_cookies.json")):
driver.add_cookie(cookie)
driver.get(POST_URL)
time.sleep(3)
comments = driver.find_elements(By.CSS_SELECTOR, "article.comments-comment-item")
for c in comments:
author = c.find_element(By.CSS_SELECTOR, ".comments-comment-meta__description-title")
body = c.find_element(By.CSS_SELECTOR, ".comments-comment-item__main-content")
print(author.text, "|", body.text[:100])
driver.quit()
I did not run this against a live login, because automating a personal account is the fastest way to a restriction and I will not risk a real account for a demo. The mechanics are standard Selenium and match the open-source scripts in wide use. Two problems decide whether it works in practice, and both need handling: loading the full thread, and surviving LinkedIn’s markup.
How do you load every comment on the thread?
LinkedIn lazy-loads comments, so only the first few appear until you click “Load more comments” and expand each “Show more replies” link. A scraper that parses the page on first paint captures a handful of comments and misses the rest. The fix is a loop that keeps clicking the load button until it disappears, then expands the reply links, before you read the DOM:
# Comments are lazy-loaded. Click "Load more comments" until it is gone.
while True:
try:
more = driver.find_element(By.XPATH, "//button[contains(., 'Load more comments')]")
driver.execute_script("arguments[0].click();", more)
time.sleep(2)
except Exception:
break
# Then expand nested replies the same way before parsing.
for btn in driver.find_elements(By.XPATH, "//button[contains(., 'more repl')]"):
driver.execute_script("arguments[0].click();", btn)
time.sleep(1)
Even with the loop, a very large thread will not fully load in a browser, which is why comment scraping is best treated as targeted prospecting rather than a promise to drain every post. Pace the clicks with real pauses so the cadence stays human, since a burst of rapid clicks is itself a bot signal.
Where the Python route breaks
The Selenium route breaks on obfuscated markup and account limits. LinkedIn condenses and renames its class names often, so a selector like comments-comment-item__main-content can move without warning, and when it does the script returns blank fields with no error. You find out only when your CSV has empty columns, so check your field hit rate on every run.
The harder ceiling is your account. Every thread you open counts against one logged-in session, and practitioners widely keep a regular account under roughly 50 posts a day, or about 100 with Sales Navigator, before the behavioral layer flags it. Push past that on a single login and you risk a temporary restriction or a ban. For the full login-and-fingerprint mechanics behind this, I cover the browser setup in depth in how to scrape LinkedIn with Python. Once the account limit becomes the bottleneck, the question is how to keep collecting without your own login on the line.
How do you scrape LinkedIn comments at scale without getting blocked?
You scrape LinkedIn comments at scale without getting blocked by sending the post URL to a scraper API that handles the login, the residential proxies, and the thread pagination on the server, then returns the comments as parsed JSON. No account of yours touches the job, so the daily-post ceiling stops being your limit, and there is no authwall or CAPTCHA to defeat in your own code. In my testing, ChocoData’s LinkedIn endpoint returned a post’s commenters this way from a single call.
The request is a plain GET with the post URL and your API key:
curl "https://chocodata.com/api/v1/linkedin/post?url=https://www.linkedin.com/posts/williamhgates_example-activity-7200000000000000000-abcd&api_key=$CHOCO_API_KEY"
The Python version is the same shape, and it returns the commenters as structured records with their replies kept nested under each parent comment, ready to drop into a pipeline:
import requests, os
resp = requests.get(
"https://chocodata.com/api/v1/linkedin/post",
params={
"url": "https://www.linkedin.com/posts/williamhgates_example-activity-7200000000000000000-abcd",
"api_key": os.environ["CHOCO_API_KEY"],
},
timeout=60,
)
post = resp.json()
for c in post["comments"]:
print(c["author"], "|", c.get("headline"), "|", c["text"][:80])
for reply in c.get("replies", []):
print(" reply:", reply["author"], "|", reply["text"][:60])
Each record comes back with the name, headline, profile URL, and comment body already parsed, so there are no obfuscated selectors to chase and no cookies to refresh. This is the same route I ranked across tools in my best LinkedIn scrapers comparison, and the reason it survives is that the residential proxies and browser rendering that get around LinkedIn’s robots.txt restrictions live on the server, not on your machine. On price, the free plan covers 1,000 requests with no card, Pro works out to about $0.60 per 1,000 records, and pay-as-you-go is $0.90 per 1,000, billed only on successful requests. For a one-off pull of a single thread the free Selenium route is fine; for continuous collection across many posts, offloading the proxies and the login is the cheaper path once you price in a banned account. Before you run either at volume, it is worth knowing where the legal line sits.
Is it legal to scrape LinkedIn comments?
Scraping LinkedIn comments sits in the same gray zone as the rest of LinkedIn scraping: collecting genuinely public data is broadly defensible in the US, but LinkedIn’s own terms forbid it and comment data is personal data. The Ninth Circuit held in hiQ v. LinkedIn that scraping public data likely does not violate the Computer Fraud and Abuse Act, which is the ruling most public-data scraping leans on. The same case is also the warning, because hiQ still lost on breach of contract and settled into a $500,000 judgment.
The contract side is LinkedIn’s User Agreement, whose Section 8.2 prohibits using software, bots, browser extensions, or any automated process to scrape or copy profiles and other data, which includes post comments. Its robots.txt says the same in machine terms, disallowing automated access to the profile and search paths without permission. So an account used for automation can be restricted regardless of the CFAA question, which is the practical risk you carry on the DIY route.
The privacy layer is the one people underweight. Every comment names a person, so comment data falls under the GDPR, and the CNIL’s KASPR decision shows a regulator fining a company for treating “publicly accessible” LinkedIn data as a free pass. The safe practice is to stay on public posts, have a lawful basis for what you collect, and honor opt-outs, especially before any outreach. I walk through the full picture, including the User Agreement and the account risk, in is scraping LinkedIn legal. This is general information, not legal advice.
FAQ
Can you scrape LinkedIn comments for free?
You can scrape a small number of LinkedIn comments for free with an open-source Selenium script driving your own logged-in account, but there is no native LinkedIn export of a post's commenters and the free route is capped by the informal daily view ceiling of roughly 50 to 100 posts. Managed APIs like ChocoData include a free tier (1,000 requests) that is enough to pull a real thread end to end before you pay.
Does LinkedIn have an API for post comments?
Yes. LinkedIn's Comments API (the socialActions/comments endpoint) reads and writes comments on shares, and it returns nested replies through a parent comment URN. Access is gated behind the LinkedIn Partner Program, and it mostly covers comments on content your own app or organization manages, not the commenters on an arbitrary public post.
Why do I only get some of the comments?
LinkedIn lazy-loads comments, so a post shows only the first few until you click 'Load more comments' and expand each 'Show more replies' link. A scraper that reads the page once, without paginating, captures only what LinkedIn rendered on first paint. Very large threads will not fully load in a browser at all, which is why comment scraping works best as targeted prospecting rather than a promise to drain every viral post.
Can I scrape LinkedIn comments without logging in?
Mostly no. A logged-out request to a post URL returns an HTTP 200 sign-in shell with the comment nodes absent from the HTML, so plain requests or BeautifulSoup returns nothing usable. The two routes that do return comments are a logged-in browser session (your account, your risk) or a scraper API that reads the thread through managed residential proxies without using your login.
Can I get commenters' email addresses from a post?
Rarely. A member's email sits behind the logged-in Contact-info modal and is essentially never public, so a comment scrape returns the name, headline, profile URL, and comment text, not an email. To turn commenters into an outreach list you enrich the scraped profile URLs against a separate email database, which is a distinct step from pulling the comments.