LinkedIn is the highest-signal B2B dataset online, and comments on target-persona posts are gold for GTM teams. Direct LinkedIn scraping triggers bans, but Google SERP indexes LinkedIn posts cooperatively. This tutorial shows how to use Scavio to discover posts by topic, then fetch the post page and extract comment-level signal for CRM enrichment.
Prerequisites
- Python 3.8+
- requests library
- A Scavio API key
- A target LinkedIn topic or persona (e.g. 'SDR strategy')
Walkthrough
Step 1: Search Google for LinkedIn posts
Use a site operator to restrict results to linkedin.com/posts.
import requests, os
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'query': 'site:linkedin.com/posts "SDR strategy" 2026'})
posts = r.json()['organic_results']Step 2: Filter to post URLs
Keep only URLs that point to actual LinkedIn posts.
post_urls = [p['link'] for p in posts if '/posts/' in p['link']]Step 3: Fetch each post page
Use Scavio's page extractor to pull the rendered post content.
def fetch_post(url):
r = requests.post('https://api.scavio.dev/api/v1/extract',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'url': url, 'render_js': True})
return r.json()Step 4: Extract reactions and commenters
Parse the extracted HTML or structured data for commenter names and engagement.
from bs4 import BeautifulSoup
def extract_engagement(html):
soup = BeautifulSoup(html, 'html.parser')
commenters = [el.text.strip() for el in soup.select('[data-test-commenter]')]
return {'commenters': commenters, 'count': len(commenters)}Step 5: Enrich into CRM
Push the commenter list into your enrichment pipeline.
for post_url in post_urls[:10]:
post = fetch_post(post_url)
engagement = extract_engagement(post.get('html', ''))
print(post_url, engagement['count'], 'commenters')Python Example
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
def linkedin_posts(topic, limit=10):
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY},
json={'query': f'site:linkedin.com/posts "{topic}"'})
return [p['link'] for p in r.json()['organic_results'] if '/posts/' in p['link']][:limit]
def fetch_post(url):
r = requests.post('https://api.scavio.dev/api/v1/extract',
headers={'x-api-key': API_KEY},
json={'url': url, 'render_js': True})
return r.json()
if __name__ == '__main__':
for url in linkedin_posts('SDR strategy'):
post = fetch_post(url)
print(url, '- extracted', len(post.get('html', '')), 'chars')JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY;
async function linkedinPosts(topic, limit = 10) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ query: `site:linkedin.com/posts "${topic}"` })
});
const { organic_results } = await r.json();
return organic_results.filter(p => p.link.includes('/posts/')).slice(0, limit).map(p => p.link);
}
const posts = await linkedinPosts('SDR strategy');
console.log(`Found ${posts.length} LinkedIn posts`);Expected Output
Found 10 LinkedIn post URLs matching 'SDR strategy'. For each URL, Scavio extracts the rendered page HTML with commenter names and reaction counts. You now have a list of engaged LinkedIn users to enrich into your CRM.