# Read a Facebook page's posts from Python without a scraping package

A scraping package such as facebook-scraper runs from your own IP and needs fixing when Facebook changes its pages. From Python you can instead POST social.posts with platform facebook and the page URL to the RouterGrowth API and read the posts from the JSON: text, date, likes, comments, shares and views.

HTML page: https://www.routergrowth.com/tools/facebook/scraper-python
Part of: [Facebook tools](https://www.routergrowth.com/tools/facebook.md)

## The call

[`social.posts`](https://www.routergrowth.com/catalog/social.posts): Recent public posts for a social handle.

Price on this network: $0.007 per post plus $0.00175 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: 5 records in 10.8 s for $0.03675. Personal fields are masked. Five recent posts from Patagonia's Facebook page; the reels carry view counts and the photo posts do not.

| text | created_at | likes | replies | reposts | views |
|---|---|---|---|---|---|
| It's not pink, it's shrimp. Exceptional gear for uncommon pursuits since 1973. https://pat.ag/F/F26/InnovationUnusual | 2026-10-14 | 262 | 1 | 1 | 17772 |
| Bears Ears National Monument in Utah was the first national monument in the United States created at the urging of Tribal Nations, and the… | 2026-10-12 | 1509 | 24 | 171 | None |

## How to do it

1. **Keep the key in the environment.** Export ROUTERGROWTH_API_KEY and send it as a Bearer token from requests or httpx.
2. **POST the run.** Send capability social.posts and input platform facebook, the page URL as handle and a limit to /v1/run.
3. **Loop over result.posts.** Each post is a dict with url, text, created_at, is_video and an engagement dict.
4. **Save it.** Write the rows with csv or pandas, keyed on the post id so repeat runs do not duplicate.

## Ask it like this

- Write a Python script that reads the last ten posts of five brand pages on Facebook each Monday and saves them to a CSV. (`social.posts`)
- From Python, pull Patagonia's recent Facebook posts and flag the ones with more than 1,000 likes. (`social.posts`)
- Search Facebook for 'repair program' and then read the pages that posted, in one script. (`social.search`, `social.posts`)

## 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.posts -i '{"platform": "facebook", "handle": "https://www.facebook.com/patagonia", "limit": 5}'
```

```bash
curl -X POST https://api.routergrowth.com/v1/run \
  -H "Authorization: Bearer $ROUTERGROWTH_API_KEY" \
  -d '{"capability": "social.posts", "input": {"platform": "facebook", "handle": "https://www.facebook.com/patagonia", "limit": 5}}'
```

## Worth knowing

- **No package to patch.** The script holds no scraping logic, so a Facebook layout change does not break it.
- **Your IP is never used.** Requests to Facebook come from RouterGrowth's providers, not from the machine running the script.
- **Views on video only.** Reels and videos return a view count; photo and text posts leave it empty.

## Questions

### How is this different from the facebook-scraper package?

The package scrapes from your machine. Here your script makes one HTTP call and the scraping runs on RouterGrowth's providers.

### What Python libraries do I need?

Only an HTTP client such as requests or httpx, plus csv or pandas if you save files.

### Does it need Facebook cookies?

No. Public pages are read without a Facebook login.

### What is in each post?

id, url, text, created_at, author, is_video and engagement with likes, comments, shares and views.

## Related

- [Scrape public Facebook posts for a keyword, with no scraper to run](https://www.routergrowth.com/tools/facebook/scraper.md)
- [Scrape a Facebook business page's profile: followers, category, website](https://www.routergrowth.com/tools/facebook/profile-scraper.md)
- [Scrape a Facebook page's posts with engagement, without a scraper](https://www.routergrowth.com/tools/facebook/posts-scraper.md)
