Your competitor just posted on LinkedIn. Within 2 hours, they have 487 comments from engaged prospects—including 23 from VP-level executives at companies you're targeting.
You want to know:
- Who's commenting? (Names, titles, companies)
- What are they saying? (Sentiment, objections, interest)
- Can you reach out to these engaged prospects?
Manually, you'd click through 487 comments one by one, copying names into a spreadsheet. 3-4 hours of tedious work.
With a post comments API: 15 seconds. All 487 comments extracted with full commenter data. Exported to CSV. Ready for outreach.
But here's the problem: LinkedIn's official API doesn't give you post comments. You can see analytics on your own posts, but you can't programmatically access comments—especially not from other people's posts.
This is a goldmine for:
- Sales teams finding engaged prospects
- Marketers analyzing content performance
- Brand managers monitoring mentions
- Competitive intelligence tracking rival engagement
This guide shows you exactly how to scrape LinkedIn post comments programmatically. We'll cover real use cases (lead generation, competitor analysis, influencer tracking), working code examples, and how to build automated monitoring systems.
By the end, you'll be able to extract thousands of comments and turn engagement data into business opportunities.
Why Scrape LinkedIn Comments?
LinkedIn comments are a goldmine of business intelligence. Here's what you're missing if you're not analyzing them:
Hidden Opportunities in Comments
1. Engaged Prospects:
1Typical LinkedIn post from competitor:
2- 50,000 views
3- 487 comments
4- 23 comments from VPs at target companies
5- 157 comments from decision-makers in your ICP
6
7Manual analysis: 3-4 hours
8With API: 15 seconds
9Value: 23 warm leads you wouldn't have found otherwise2. Buying Signals:
Comments reveal intent:
- "This is exactly what we need at [Company]"
- "We've been looking for a solution like this"
- "How does this compare to [current tool]?"
- "Interested in learning more"
These people are raising their hands. You just need to see them.
3. Competitive Intelligence:
- What questions do prospects ask your competitors?
- What objections come up repeatedly?
- Which features get the most positive reaction?
- Who are their most engaged followers?
4. Content Strategy:
- What topics generate the most discussion?
- Which posts go viral in your industry?
- What tone/format works best?
- Which influencers amplify content?
The Economics
Manual comment analysis:
1Scenario: Analyze 10 competitor posts per week
2Average comments per post: 200
3Time per comment analysis: 30 seconds
4Total time: 100 minutes per post
5Weekly time: 1,000 minutes (16.7 hours)
6Monthly cost at $50/hour: $3,335
7
8Annual cost: $40,000API automation:
1Same 10 posts per week
2Time per post: 15 seconds
3Weekly time: 2.5 minutes
4Monthly cost at $0.001 per comment: $80
5
6Annual cost: $960 + negligible time
7
8Savings: $39,040/year
9ROI: 4,065%Real Business Impact
Sales team example:
- Monitors 5 competitor posts daily
- Each post has 150+ comments
- Identifies 10-15 engaged prospects/day
- 5% convert to opportunities
- Result: 15-20 new opportunities/month from comment monitoring
Content team example:
- Analyzes 100 top-performing industry posts/month
- Identifies trending topics and successful formats
- Improves content strategy based on real engagement data
- Result: 3x increase in post engagement
Brand manager example:
- Monitors all mentions of company/products in comments
- Responds to questions and concerns in real-time
- Tracks sentiment across thousands of comments
- Result: 40% faster response time to brand mentions
Official API vs Unofficial API
Let's be clear about LinkedIn's official API limitations:
LinkedIn Official API
What you CANNOT do:
- ❌ Get comments from other people's posts
- ❌ Get comments from company pages you don't manage
- ❌ Extract commenter profile data
- ❌ Search comments by keyword
- ❌ Analyze competitor post engagement
- ❌ Track brand mentions in comments
What you CAN do (very limited):
- ✅ Get comments on YOUR posts (only)
- ✅ Get analytics on YOUR company page posts
- ✅ Respond to comments via API (on your posts)
The reality: Official API only works for posts you own. For competitive intelligence, lead generation, or market research, it's useless.
Unofficial Post Comments APIs
These APIs access LinkedIn's publicly visible post data, including comments.
How they work:
- You provide a LinkedIn post URL or URN
- API retrieves the post and all comments
- Returns structured data: commenter profiles, comment text, timestamps, reactions
- No LinkedIn account needed (account-less)
Legal status: Comments on public posts are publicly visible data. The hiQ Labs case (2022) established that scraping publicly available data is legal.
Key difference:
1Official API:
2"Give me comments on MY posts" ✓
3"Give me comments on OTHER posts" ✗
4
5Unofficial API:
6"Give me comments on MY posts" ✓
7"Give me comments on OTHER posts" ✓For 95% of use cases (competitive analysis, lead gen, market research), you need an unofficial API.
What Data You Can Extract
Here's everything you can get from LinkedIn post comments:
Comment Data
1{
2 "comment": {
3 "text": "This is exactly what we've been looking for! We're currently using [competitor] but this looks much better.",
4 "commentId": "urn:li:comment:123456789",
5 "createdAt": "2025-01-08T14:30:00Z",
6 "likes": 12,
7 "replies": 3
8 }
9}Commenter Profile Data
1{
2 "commenter": {
3 "fullName": "Sarah Johnson",
4 "headline": "VP of Marketing at Acme Corp",
5 "username": "sarahjohnson",
6 "profileUrl": "https://linkedin.com/in/sarahjohnson",
7 "company": "Acme Corp",
8 "location": "San Francisco Bay Area",
9 "connectionDegree": "2nd",
10 "profilePicture": "https://..."
11 }
12}Post Context
1{
2 "post": {
3 "text": "Excited to announce our new product launch...",
4 "postUrl": "https://linkedin.com/posts/...",
5 "author": "John Smith",
6 "authorCompany": "TechCorp",
7 "postedAt": "2025-01-08T09:00:00Z",
8 "likes": 1247,
9 "comments": 487,
10 "reposts": 89
11 }
12}What This Means
You can:
- Identify engaged prospects (name, title, company)
- Analyze sentiment (what people are saying)
- Track competitors (who engages with their content)
- Find influencers (who gets the most engagement on their comments)
- Monitor brand mentions (keywords in comments)
- Generate leads (people asking questions or showing interest)
LinkdAPI Post Methods
LinkdAPI provides comprehensive post and comment scraping capabilities:
Get Post Comments
1from linkdapi import LinkdAPI
2
3api = LinkdAPI("your_api_key")
4
5# Get all comments on a post
6post_urn = "urn:li:activity:7287901045647712257"
7comments = api.get_post_comments(post_urn=post_urn)
8
9print(f"Found {len(comments['data'])} comments")
10
11for comment in comments['data']:
12 print(f"- {comment['commenter']['fullName']}: {comment['text'][:100]}...")Get Post Data (Including Comment Count)
1# Get post details
2post_data = api.get_post_info(post_urn=post_urn)
3
4print(f"Post by: {post_data['data']['author']}")
5print(f"Text: {post_data['data']['text'][:200]}...")
6print(f"Likes: {post_data['data']['likes']}")
7print(f"Comments: {post_data['data']['commentCount']}")
8print(f"Reposts: {post_data['data']['reposts']}")Extract Post URN from URL
1# You have a LinkedIn post URL
2url = "https://www.linkedin.com/posts/username_activity-7287901045647712257-abcd"
3
4# Extract the URN (activity ID)
5import re
6
7match = re.search(r'activity[:-](\d+)', url)
8if match:
9 activity_id = match.group(1)
10 post_urn = f"urn:li:activity:{activity_id}"
11
12 # Now get comments
13 comments = api.get_post_comments(post_urn=post_urn)Get Company Posts (With Comments)
1# Get recent posts from a company
2company_id = "1441" # OpenAI
3posts = api.get_company_posts(company_id=company_id, start=0)
4
5# Analyze comments on each post
6for post in posts['data']:
7 post_urn = post['urn']
8 comments = api.get_post_comments(post_urn=post_urn)
9
10 print(f"Post: {post['text'][:100]}...")
11 print(f" Comments: {len(comments['data'])}")Get Profile Posts (With Comments)
1# Get posts from a specific person
2username = "billgates"
3posts = api.get_profile_posts(username=username)
4
5# Analyze engagement
6for post in posts['data']:
7 comments = api.get_post_comments(post_urn=post['urn'])
8
9 print(f"Post engagement:")
10 print(f" Likes: {post['likes']}")
11 print(f" Comments: {len(comments['data'])}")
12 print(f" Engagement rate: {(post['likes'] + len(comments['data'])) / post['impressions'] * 100:.2f}%")Async Bulk Comment Extraction
1from linkdapi import AsyncLinkdAPI
2import asyncio
3
4async def get_all_comments(post_urns):
5 """
6 Get comments from multiple posts concurrently
7 """
8 async with AsyncLinkdAPI("your_api_key") as api:
9 # Create tasks for all posts
10 tasks = [api.get_post_comments(post_urn=urn) for urn in post_urns]
11
12 # Execute all at once
13 results = await asyncio.gather(*tasks, return_exceptions=True)
14
15 return results
16
17# Get comments from 50 posts in seconds
18post_urns = [f"urn:li:activity:{i}" for i in range(50)]
19all_comments = asyncio.run(get_all_comments(post_urns))
20
21total_comments = sum(len(r['data']) for r in all_comments if isinstance(r, dict))
22print(f"Extracted {total_comments} total comments from {len(post_urns)} posts")Use Case 1: Lead Generation from Engagement
Scenario: You want to find prospects who are actively engaged with your competitor's content.
Why This Works
When someone comments on your competitor's post, they're:
- Aware of the problem (why they're following that company)
- Actively looking (engaged enough to comment)
- In market (showing interest publicly)
- Warmer leads (already familiar with the category)
These are your best prospects.
Step 1: Monitor Competitor Posts
1from linkdapi import LinkdAPI
2import time
3
4api = LinkdAPI("your_api_key")
5
6# Your main competitors (LinkedIn usernames or company IDs)
7competitors = [
8 {"name": "Competitor A", "id": "12345"},
9 {"name": "Competitor B", "id": "67890"},
10 {"name": "Competitor C", "id": "11223"}
11]
12
13def get_recent_competitor_posts(competitor_id, num_posts=10):
14 """
15 Get recent posts from a competitor
16 """
17 posts = api.get_company_posts(company_id=competitor_id, start=0)
18 return posts['data'][:num_posts]
19
20# Get latest posts from all competitors
21all_competitor_posts = []
22
23for comp in competitors:
24 print(f"Fetching posts from {comp['name']}...")
25 posts = get_recent_competitor_posts(comp['id'])
26
27 for post in posts:
28 post['competitor'] = comp['name']
29
30 all_competitor_posts.extend(posts)
31 time.sleep(1) # Be nice to API
32
33print(f"Found {len(all_competitor_posts)} competitor posts to analyze")Step 2: Extract Engaged Prospects
1def extract_engaged_prospects(post):
2 """
3 Get all commenters from a post
4 """
5 comments = api.get_post_comments(post_urn=post['urn'])
6
7 prospects = []
8
9 for comment in comments['data']:
10 commenter = comment['commenter']
11
12 # Extract relevant data
13 prospect = {
14 'name': commenter['fullName'],
15 'title': commenter['headline'],
16 'company': commenter.get('company', 'N/A'),
17 'location': commenter.get('location', 'N/A'),
18 'linkedin_url': f"https://linkedin.com/in/{commenter['username']}",
19 'comment_text': comment['text'],
20 'post_url': post['postUrl'],
21 'competitor': post['competitor'],
22 'commented_at': comment['createdAt']
23 }
24
25 prospects.append(prospect)
26
27 return prospects
28
29# Extract all prospects from competitor posts
30all_prospects = []
31
32for post in all_competitor_posts:
33 print(f"Analyzing post: {post['text'][:50]}...")
34 prospects = extract_engaged_prospects(post)
35 all_prospects.extend(prospects)
36 print(f" Found {len(prospects)} commenters")
37
38print(f"\nTotal prospects found: {len(all_prospects)}")Step 3: Qualify and Score Leads
1def score_prospect(prospect):
2 """
3 Score prospect based on comment quality and profile
4 """
5 score = 0
6
7 # Title scoring (decision-makers get higher scores)
8 title = prospect['title'].lower()
9 if any(term in title for term in ['vp', 'vice president', 'director', 'head of', 'ceo', 'cto', 'cmo']):
10 score += 10
11 elif any(term in title for term in ['manager', 'lead']):
12 score += 5
13
14 # Comment analysis (buying signals)
15 comment = prospect['comment_text'].lower()
16
17 # Positive signals
18 if any(phrase in comment for phrase in [
19 'interested',
20 'this is exactly',
21 'we need',
22 'looking for',
23 'how does this',
24 'pricing',
25 'demo',
26 'would love to'
27 ]):
28 score += 15 # Strong buying signal!
29
30 # Questions (show genuine interest)
31 if '?' in comment:
32 score += 5
33
34 # Longer, thoughtful comments
35 if len(comment) > 100:
36 score += 3
37
38 # Company size estimate (rough, based on title)
39 if any(term in title for term in ['enterprise', 'global', 'senior']):
40 score += 5
41
42 return score
43
44# Score all prospects
45for prospect in all_prospects:
46 prospect['lead_score'] = score_prospect(prospect)
47
48# Sort by score (highest first)
49all_prospects.sort(key=lambda x: x['lead_score'], reverse=True)
50
51# Filter for high-quality leads
52hot_leads = [p for p in all_prospects if p['lead_score'] >= 15]
53
54print(f"\nHot leads (score ≥ 15): {len(hot_leads)}")
55print(f"Medium leads (score 10-14): {len([p for p in all_prospects if 10 <= p['lead_score'] < 15])}")
56print(f"Low leads (score < 10): {len([p for p in all_prospects if p['lead_score'] < 10])}")Step 4: Export for Outreach
1import csv
2
3def export_leads(leads, filename='competitor_leads.csv'):
4 """
5 Export leads to CSV for sales team
6 """
7 with open(filename, 'w', newline='', encoding='utf-8') as f:
8 fieldnames = [
9 'Name', 'Title', 'Company', 'Location', 'LinkedIn URL',
10 'Lead Score', 'Comment', 'Competitor Post', 'Date'
11 ]
12 writer = csv.DictWriter(f, fieldnames=fieldnames)
13 writer.writeheader()
14
15 for lead in leads:
16 writer.writerow({
17 'Name': lead['name'],
18 'Title': lead['title'],
19 'Company': lead['company'],
20 'Location': lead['location'],
21 'LinkedIn URL': lead['linkedin_url'],
22 'Lead Score': lead['lead_score'],
23 'Comment': lead['comment_text'][:200], # Truncate long comments
24 'Competitor Post': lead['competitor'],
25 'Date': lead['commented_at']
26 })
27
28 print(f"Exported {len(leads)} leads to {filename}")
29
30# Export hot leads for immediate outreach
31export_leads(hot_leads, 'hot_leads.csv')
32
33# Export all leads for nurture campaign
34export_leads(all_prospects, 'all_competitor_leads.csv')Step 5: Personalized Outreach Template
1def generate_outreach_message(lead):
2 """
3 Generate personalized message based on their comment
4 """
5 template = f"""
6Hi {lead['name'].split()[0]},
7
8I noticed your comment on {lead['competitor']}'s post about [topic].
9
10You mentioned: "{lead['comment_text'][:100]}..."
11
12We help companies like {lead['company']} with [your solution].
13Based on your comment, I think you'd find [specific feature] particularly interesting.
14
15Would you be open to a quick 15-minute chat this week?
16
17Best,
18[Your Name]
19 """
20
21 return template.strip()
22
23# Generate personalized messages for top 10 leads
24for i, lead in enumerate(hot_leads[:10], 1):
25 print(f"\n--- Lead #{i} ---")
26 print(f"To: {lead['name']} ({lead['title']} at {lead['company']})")
27 print(f"Score: {lead['lead_score']}")
28 print(f"\nMessage:")
29 print(generate_outreach_message(lead))Result:
- 50+ hot leads identified from competitor engagement
- Fully qualified with scores
- Personalized outreach ready to send
- Time: 15 minutes vs 20+ hours manual
Use Case 2: Competitor Analysis
Scenario: You want to understand what's working (and not working) for your competitors.
What You Can Learn
- Content strategy: What topics get engagement?
- Objections: What concerns do prospects have?
- Feature requests: What do people ask for?
- Sentiment: Are people positive or negative?
- Influencers: Who amplifies their content?
Comprehensive Competitor Intelligence
1def analyze_competitor_posts(competitor_name, company_id, num_posts=20):
2 """
3 Deep analysis of competitor's LinkedIn presence
4 """
5 # Get their recent posts
6 posts = api.get_company_posts(company_id=company_id, start=0)
7 posts_to_analyze = posts['data'][:num_posts]
8
9 analysis = {
10 'competitor': competitor_name,
11 'total_posts': len(posts_to_analyze),
12 'total_engagement': 0,
13 'total_comments': 0,
14 'top_posts': [],
15 'common_themes': {},
16 'sentiment': {'positive': 0, 'neutral': 0, 'negative': 0},
17 'questions_asked': [],
18 'feature_requests': []
19 }
20
21 for post in posts_to_analyze:
22 # Get post engagement
23 comments = api.get_post_comments(post_urn=post['urn'])
24
25 engagement = post['likes'] + len(comments['data']) + post.get('reposts', 0)
26 analysis['total_engagement'] += engagement
27 analysis['total_comments'] += len(comments['data'])
28
29 # Track top posts
30 analysis['top_posts'].append({
31 'text': post['text'][:200],
32 'engagement': engagement,
33 'comments': len(comments['data']),
34 'url': post['postUrl']
35 })
36
37 # Analyze comments
38 for comment in comments['data']:
39 text = comment['text'].lower()
40
41 # Sentiment analysis (simple)
42 positive_words = ['love', 'great', 'excellent', 'amazing', 'perfect', 'awesome']
43 negative_words = ['bad', 'poor', 'terrible', 'awful', 'disappointed', 'frustrating']
44
45 if any(word in text for word in positive_words):
46 analysis['sentiment']['positive'] += 1
47 elif any(word in text for word in negative_words):
48 analysis['sentiment']['negative'] += 1
49 else:
50 analysis['sentiment']['neutral'] += 1
51
52 # Track questions
53 if '?' in text:
54 analysis['questions_asked'].append(text)
55
56 # Track feature requests
57 if any(phrase in text for phrase in ['would be great if', 'wish you had', 'need', 'missing']):
58 analysis['feature_requests'].append(text)
59
60 # Sort top posts by engagement
61 analysis['top_posts'].sort(key=lambda x: x['engagement'], reverse=True)
62
63 return analysis
64
65# Analyze your main competitor
66competitor_analysis = analyze_competitor_posts(
67 "Competitor A",
68 "12345",
69 num_posts=20
70)
71
72# Generate report
73print(f"\n{'='*60}")
74print(f"COMPETITOR ANALYSIS: {competitor_analysis['competitor']}")
75print(f"{'='*60}")
76print(f"\nPosts analyzed: {competitor_analysis['total_posts']}")
77print(f"Total engagement: {competitor_analysis['total_engagement']:,}")
78print(f"Total comments: {competitor_analysis['total_comments']:,}")
79print(f"Avg engagement per post: {competitor_analysis['total_engagement'] / competitor_analysis['total_posts']:.0f}")
80
81print(f"\n--- SENTIMENT ---")
82total_sentiment = sum(competitor_analysis['sentiment'].values())
83for sentiment, count in competitor_analysis['sentiment'].items():
84 percentage = (count / total_sentiment * 100) if total_sentiment > 0 else 0
85 print(f"{sentiment.capitalize()}: {count} ({percentage:.1f}%)")
86
87print(f"\n--- TOP 5 POSTS ---")
88for i, post in enumerate(competitor_analysis['top_posts'][:5], 1):
89 print(f"{i}. Engagement: {post['engagement']}")
90 print(f" Text: {post['text']}...")
91 print(f" Comments: {post['comments']}")
92 print()
93
94print(f"\n--- COMMON QUESTIONS ({len(competitor_analysis['questions_asked'])} total) ---")
95for question in competitor_analysis['questions_asked'][:10]:
96 print(f"• {question[:150]}...")
97
98print(f"\n--- FEATURE REQUESTS ({len(competitor_analysis['feature_requests'])} total) ---")
99for request in competitor_analysis['feature_requests'][:10]:
100 print(f"• {request[:150]}...")Result: Complete competitive intelligence report showing:
- What content resonates
- What questions prospects ask
- What features they want
- Overall sentiment
- Top performing posts
Start building with 100 free credits
Access profiles, companies, jobs, and more through our reliable, high-performance API. No credit card required.
Use Case 3: Brand Monitoring
Scenario: You want to track every mention of your brand, products, or executives in LinkedIn comments.
Why This Matters
People mention brands in comments, not just in posts:
- Questions about your product
- Comparisons to competitors
- Customer testimonials
- Support requests
- Feature feedback
You need to see these in real-time.
Automated Brand Monitoring System
1import time
2from datetime import datetime
3
4# Keywords to monitor
5BRAND_KEYWORDS = [
6 'YourCompany',
7 'YourProduct',
8 'your-company', # Handle variations
9 'YourCEO' # Executive mentions
10]
11
12COMPETITOR_KEYWORDS = [
13 'CompetitorA',
14 'CompetitorB'
15]
16
17def monitor_post_comments(post_urn, keywords):
18 """
19 Check if any keywords appear in post comments
20 """
21 comments = api.get_post_comments(post_urn=post_urn)
22
23 matches = []
24
25 for comment in comments['data']:
26 text = comment['text']
27
28 # Check for keyword matches
29 for keyword in keywords:
30 if keyword.lower() in text.lower():
31 matches.append({
32 'keyword': keyword,
33 'commenter': comment['commenter']['fullName'],
34 'title': comment['commenter']['headline'],
35 'comment': text,
36 'url': f"https://linkedin.com/in/{comment['commenter']['username']}",
37 'timestamp': comment['createdAt']
38 })
39
40 return matches
41
42def scan_industry_posts(industry_influencers, keywords):
43 """
44 Scan posts from industry influencers for brand mentions
45 """
46 all_mentions = []
47
48 for influencer in industry_influencers:
49 print(f"Scanning posts from {influencer['name']}...")
50
51 # Get their recent posts
52 posts = api.get_profile_posts(username=influencer['username'])
53
54 for post in posts['data'][:5]: # Check last 5 posts
55 mentions = monitor_post_comments(post['urn'], keywords)
56
57 if mentions:
58 for mention in mentions:
59 mention['post_author'] = influencer['name']
60 mention['post_text'] = post['text'][:100]
61 all_mentions.append(mention)
62
63 return all_mentions
64
65# Industry influencers to monitor
66industry_influencers = [
67 {'name': 'Thought Leader 1', 'username': 'thoughtleader1'},
68 {'name': 'Thought Leader 2', 'username': 'thoughtleader2'},
69 {'name': 'Industry News', 'username': 'industrynews'}
70]
71
72# Scan for brand mentions
73brand_mentions = scan_industry_posts(industry_influencers, BRAND_KEYWORDS)
74
75print(f"\n🔔 FOUND {len(brand_mentions)} BRAND MENTIONS\n")
76
77for mention in brand_mentions:
78 print(f"Keyword: {mention['keyword']}")
79 print(f"Mentioned by: {mention['commenter']} ({mention['title']})")
80 print(f"On post by: {mention['post_author']}")
81 print(f"Comment: {mention['comment'][:150]}...")
82 print(f"Profile: {mention['url']}")
83 print(f"Time: {mention['timestamp']}")
84 print("-" * 60)


