# Scrape LinkedIn from a Python script with a single POST request

Skip Selenium, cookies and proxy pools. From Python, send one POST with requests to the RouterGrowth run endpoint with the capability social.search, platform linkedin and your keyword, then read the posts from the JSON result: text, author, date, likes and comments. The script holds an API key, nothing else.

HTML page: https://www.routergrowth.com/tools/linkedin/scrape-python
Part of: [LinkedIn tools](https://www.routergrowth.com/tools/linkedin.md)

## The call

[`social.search`](https://www.routergrowth.com/catalog/social.search): Public posts matching a keyword on X, LinkedIn, Reddit, YouTube, TikTok, Instagram or Facebook: brand mentions, category conversations, competitor chatter.

Price on this network: $0.0035 per post plus $0.000088 per call, $0.002 minimum a call. The exact quote is shown before every run.

## What a real run returned

Run on 2026-10-19: 6 records in 4.5 s for $0.021088. Personal fields are masked. Six public LinkedIn posts for "cold email deliverability" from the past three weeks, each with likes and a comment count.

| text | author | created_at | likes | replies |
|---|---|---|---|---|
| Most cold email deliverability problems are not copywriting problems. They are infrastructure problems. Your DNS configuration sends signal… | Ma*** | 2026-10-07 | 20 | 21 |
| In 2026, deliverability has been tougher than ever. What's your average reply rate on cold email right now? | An*** | 2026-10-01 | 6 | 5 |
| Most cold email has an offer problem. Not a personalization problem. If the offer is good enough, you don’t need a brand. You don’t need to… | Jo*** | 2026-10-15 | 53 | 23 |

## How to do it

1. **Store the key.** Put your RouterGrowth key in an environment variable such as ROUTERGROWTH_API_KEY and send it as a Bearer token.
2. **POST the run.** Send capability social.search with input platform, query and limit to https://api.routergrowth.com/v1/run, with a max_cost in routing.
3. **Read result.posts.** The response JSON holds the run id, the billing block and result.posts, a list of dicts ready for a loop.
4. **Write the file.** Use the csv module or pandas to save text, author, created_at and the engagement counts.

## Ask it like this

- Write a Python script that searches LinkedIn for three keywords every morning and appends new posts to a CSV. (`social.search`)
- Search LinkedIn for 'cold email deliverability' and pull the comments under the post with the most replies. (`social.search`, `social.comments`)

## Connect

MCP server: `https://api.routergrowth.com/mcp`

```bash
claude mcp add --transport http routergrowth https://api.routergrowth.com/mcp
```

```bash
npm install -g routergrowth && routergrowth setup
routergrowth run -c social.search -i '{"platform": "linkedin", "query": "cold email deliverability", "limit": 6}'
```

```bash
curl -X POST https://api.routergrowth.com/v1/run \
  -H "Authorization: Bearer $ROUTERGROWTH_API_KEY" \
  -d '{"capability": "social.search", "input": {"platform": "linkedin", "query": "cold email deliverability", "limit": 6}}'
```

## Worth knowing

- **No browser in your script.** The script makes an HTTP call and parses JSON. No driver, headless Chrome or proxy settings to keep in sync.
- **Wait or poll.** A run can return when it finishes, or hand back a run id to poll at /v1/runs/<id> while your script does other work.
- **Same key everywhere.** The key in your script is the key the CLI and the MCP server use, and every run lands in one history.

## Questions

### Do I need Selenium or Playwright?

No. A plain HTTP client such as requests or httpx is enough; the scraping happens on RouterGrowth's providers.

### How does the script authenticate?

With an Authorization header holding Bearer and your RouterGrowth API key.

### What comes back in the JSON?

A run record: run_id, status, billing with the quote and the charge, timing, and result.posts with one dict per post.

### Can it run on a schedule?

Yes. Cron, a GitHub Action or any job runner can call the endpoint; each call is billed per post returned.

## Related

- [Get a company's LinkedIn firmographics from its domain in one call](https://www.routergrowth.com/tools/linkedin/company-scraper.md)
- [Search people the way LinkedIn search does, from one API call](https://www.routergrowth.com/tools/linkedin/search-api.md)
- [Scrape LinkedIn posts that mention a keyword, without running a scraper](https://www.routergrowth.com/tools/linkedin/scraper.md)
- [Scrape a LinkedIn company page's posts with likes, comments and reposts](https://www.routergrowth.com/tools/linkedin/post-scraper.md)
- [Get a company's LinkedIn job postings from one API call](https://www.routergrowth.com/tools/linkedin/jobs-api.md)
- [Scrape LinkedIn jobs for a title in a city, without a scraper to run](https://www.routergrowth.com/tools/linkedin/job-scraper.md)
- [What reading LinkedIn company posts costs when you pay per record](https://www.routergrowth.com/tools/linkedin/api-costs.md)
- [How Claude reads public LinkedIn posts, jobs and companies](https://www.routergrowth.com/tools/linkedin/claude.md)
- [Read a LinkedIn company page's posts through one REST call](https://www.routergrowth.com/tools/linkedin/api.md)
