[Home](https://scrapfly.io/)/[Scrapers](https://scrapfly.io/scrapers)/Facebook

Pages · posts · Marketplace · events · groups

# // Facebook Scraper API

Scrape public Facebook Pages, posts, Marketplace listings, events and groups as clean JSON. No Facebook account, no login, and Scrapfly handles the blocking.

- **Clone it and run it.** An open-source Facebook scraper for Pages, Marketplace listings, events and group posts, tested against live Facebook every night.
- **Any public Facebook URL.** Send a Page, a Marketplace search, an event, a group or a public profile, and get the data back from one request.
 
 [Get free API key](https://scrapfly.io/register) [View GitHub scraper](https://github.com/scrapfly/scrapfly-scrapers/tree/main/facebook-scraper) [Read rendering docs](https://scrapfly.io/docs/scrape-api/javascript-rendering) 

1,000 free credits. No credit card required.

 [](https://www.capterra.com/p/212653/Scrapfly/)★★★★★4.9/5 from 236 reviews

 

 

 Any public Facebook URL

 

 

 Page JSON**Output**

```
{
  <span class="c-str">"name"</span>: <span class="c-str">"BBC News"</span>,
  <span class="c-str">"page_id"</span>: <span class="c-str">"228735667216"</span>,
  <span class="c-str">"category"</span>: <span class="c-str">"Media/news company"</span>,
  <span class="c-str">"followers"</span>: <span class="c-num">62044419</span>,
  <span class="c-str">"talking_about"</span>: <span class="c-num">730075</span>,
  <span class="c-str">"were_here"</span>: <span class="c-num">9302</span>
}
```

Printed by the Python request below[See the request ↓](#implementation)

  

What you can scrape from Facebook

Five kinds of public Facebook data you can scrape with Scrapfly, no login required.

 ## // Scrape Facebook Pages

Name, Page ID, category, intro and exact follower counts, plus the website, email, phone, address, price range and rating that business Pages list.

- name
- page\_id
- category
- followers
- website
- phone
- address

  ## // Scrape Facebook posts

Text, posting time, and reaction, comment and share counts for a Page's latest posts. Facebook loads posts as you scroll, so scroll the page with a JavaScript scenario and use residential proxies.

- text
- time
- reactions
- comments
- shares

  ## // Scrape Facebook Marketplace listings

Title, price, location, seller, photo and listing time from Marketplace search results, ready for price tracking.

- title
- price
- location
- seller
- photo
- listed time

  ## // Scrape Facebook events

Title, date, venue address, cover photo and online or in-person status, from event search results or an event's own page.

- title
- date
- location
- cover photo
- is\_online

  ## // Scrape Facebook group posts

Post text, author, posting time, reactions and photos from public Facebook groups. Scroll with residential proxies to load more posts.

- text
- author
- time
- reactions
- media

  



Reliability

## // Get Facebook data without a login

Facebook shows public Pages, Marketplace, events and groups to signed-out visitors, with a login prompt over the top. Scrapfly renders the page and returns the data underneath, so you never log in or put an account at risk.

`render_js=true`Facebook builds its pages in the browser. Render them, and Facebook serves the page instead of sending you to its login screen.



`/login/`A login redirect still returns HTTP 200, so the status code won't tell you. Check the final URL for `/login/` and retry.



`proxy_pool="residential"`Page details load on datacenter proxies. Unblocker switches Marketplace, group and event requests to residential on its own; set it yourself for scrolling post feeds.



 



Choose your tools

## // Scrapfly products for Facebook scraping

Scrapfly's Facebook scraping API is the Web Scraping API with rendering on, and most jobs need nothing else. Add the others for prompt-based extraction, screenshots, browser sessions or lists of URLs. One API key covers all of them.

 ### Web Scraping API for Facebook

Fetch any public Facebook URL with rendering on: a Page, a Marketplace search, an event or a group.

A Page's details sit in its meta tags and embedded JSON, so one request covers name, category, follower counts and contact details.

 

```
GET /scrape?url=https://www.facebook.com/bbcnews&unblocker=true&render_js=true&country=US
```

 [Explore Web Scraping API →](https://scrapfly.io/products/web-scraping-api)  ### Data Extraction API for Marketplace listings

Name the fields in plain words with `extraction_prompt` and get them back with the page, with no parser to write.

Ask a Marketplace search for titles, prices and locations, and you get them for every listing on the page.

 

```
GET /scrape?url=https://www.facebook.com/marketplace/search/?query=electronics&unblocker=true&render_js=true&proxy_pool=residential&country=US&extraction_prompt=listing+titles,+prices+and+locations
```

 [Explore Data Extraction API →](https://scrapfly.io/products/extraction-api)  ### Screenshot API for Facebook Pages

A full-page capture of any public Page: cover, intro with contact details, and the latest post.

Keep a visual record of how a Page looked on a given day.

 

```
GET /screenshot?url=https://www.facebook.com/bbcnews&country=us&capture=fullpage&format=png
```

 [Explore Screenshot API →](https://scrapfly.io/products/screenshot-api)  ### Cloud Browser API for Facebook sessions

Point your Playwright or Puppeteer script at a hosted browser when the job needs clicks or scrolling, such as opening a Page's About tab or scrolling a Marketplace search.

The browser runs on Scrapfly's proxies, so your script never reaches Facebook from your own IP.

 

```
chromium.connect_over_cdp("wss://browser.scrapfly.io?key=KEY&country=us")
```

 [Explore Cloud Browser API →](https://scrapfly.io/products/cloud-browser-api)  ### Crawler API for lists of Facebook URLs

Submit a list of URLs as one job, with [Unblocker](https://scrapfly.io/products/unblocker) (formerly ASP) and a rendering delay applied to every URL. Mix Pages, Marketplace searches and events in one job. Ask for HTML output: Facebook keeps its data in the page's embedded JSON, which markdown drops.

- url\_list
- unblocker
- rendering\_delay
- content\_formats

 [Explore Crawler API →](https://scrapfly.io/products/crawler-api)  



One request

## // Fetch a Facebook Page and read its details

The JSON at the top is what this code prints: one rendered request, then the Page's name, ID, category and follower counts read from its meta tags and embedded JSON. No CSS selectors to maintain.

**Prefer the full scraper?** The open-source [Facebook scraper on GitHub](https://github.com/scrapfly/scrapfly-scrapers/tree/main/facebook-scraper) covers Pages, Marketplace listings, events and group posts in Python 3.10 and runs against live Facebook every night. Clone it, set `SCRAPFLY_KEY`, and run `poetry run python run.py`.

 

 Python · scrapfly-sdkscrape + parse

```
<span class="c-key">import</span> re
<span class="c-key">from</span> scrapfly <span class="c-key">import</span> ScrapeConfig, ScrapflyClient

client = ScrapflyClient(key=<span class="c-str">"YOUR_SCRAPFLY_KEY"</span>)
result = client.scrape(ScrapeConfig(
  <span class="c-str">"https://www.facebook.com/bbcnews"</span>,
  unblocker=<span class="c-key">True</span>,  <span class="c-com"># previously asp</span>
  country=<span class="c-str">"US"</span>, render_js=<span class="c-key">True</span>,
))
og = <span class="c-key">lambda</span> p: result.selector.css(<span class="c-str">f'</span><span class="c-str">meta[property="og:</span>{p}<span class="c-str">"]::attr(content)</span><span class="c-str">'</span>).get()
<span class="c-key">if</span> <span class="c-key">not</span> og(<span class="c-str">"url"</span>):
  <span class="c-key">raise</span> RuntimeError(<span class="c-str">"Facebook served its login page, retry the request"</span>)
page_id, category = re.search(
  <span class="c-str">r'"delegate_page":\{"id":"(\d+)","category_name":"([^"]+)"'</span>, result.content).groups()
counts = re.findall(<span class="c-str">r"([\d,]+) (followers|talking about|were here)"</span>, og(<span class="c-str">"description"</span>))
page = {
  <span class="c-str">"name"</span>: og(<span class="c-str">"title"</span>).split(<span class="c-str">" | "</span>)[<span class="c-num">0</span>],
  <span class="c-str">"page_id"</span>: page_id,
  <span class="c-str">"category"</span>: category.replace(<span class="c-str">"\\/"</span>, <span class="c-str">"/"</span>),
  **{k.replace(<span class="c-str">" "</span>, <span class="c-str">"_"</span>): int(v.replace(<span class="c-str">","</span>, <span class="c-str">""</span>)) <span class="c-key">for</span> v, k <span class="c-key">in</span> counts},
}
```

 

 



What the data is used for

## // Common Facebook scraping use cases

### Lead lists

Pull phone, email, website and address from a list of local business Pages.



### Marketplace price tracking

Record asking prices and new listings for a product search, and spot items marked sold.



### Event listings

Collect upcoming events for a city or topic with dates, venues and cover photos.



### Competitor monitoring

Track what competing Pages post and how many reactions, comments and shares each post gets.



### Audience tracking

Record follower and “talking about” counts per Page on a schedule.



### Community research

Follow what public groups in your niche discuss, with reactions on every post.



 



Common questions

## // Facebook scraping FAQ

 Is scraping Facebook legal?There is no universal answer. Legality depends on your jurisdiction, the data, the access method and how you use the result. Keep the workflow to public pages, avoid signed-in and private content, treat names in posts, groups and profiles as personal data, review Facebook's terms, and get legal advice for commercial use.

 Do I need a Facebook account or access token?No. Scrapfly loads public Facebook pages signed out, so there is no Facebook login, app or access token to manage. You only need a Scrapfly API key.

 Why do I get Facebook's login page instead of the data?Facebook sometimes redirects signed-out visitors to its login page, and the redirect still returns HTTP 200. Render the page with `render_js=true`, check that the final URL does not contain `/login/`, and retry when it does.

 Can I scrape Facebook Marketplace?Yes. Render a Marketplace search URL and get each listing with its title, price, location, seller and photo. Unblocker sends Marketplace requests through residential proxies on its own.

 Can I scrape posts from a Facebook Page or group?Yes, the most recent ones. Render the Page or group on residential proxies with a JavaScript scenario that closes the login dialog and scrolls. Each post comes with its text, posting time and reaction count.

 Can I scrape public Facebook profiles?Yes, public ones. A public profile loads signed out like a Page, with the name, exact follower count, intro, and the work, education and hometown its owner made public.

 Is the follower count exact?Yes. The header shows a rounded label such as 62M, but the page's `og:description` meta tag carries the exact number, such as 62,044,419.

 How much does scraping Facebook cost?A rendered Page costs 21 credits on datacenter proxies. Marketplace, groups and post feeds run on residential proxies at 45. Both include 15 credits for facebook.com. An extraction prompt adds 10 to 15 credits, and a Screenshot API capture costs 60. Every account starts with 1,000 free credits.

 What are the rate limits when scraping Facebook?Scrapfly sets no Facebook-specific limit. Your maximum parallelism is the concurrency quota on your plan, or a lower cap configured for the project. Each in-flight request uses one slot until it finishes.

 



Start with one request

## Fetch the URL. Read the JSON.

Web Scraping API with rendering on, one call per Facebook URL.

Proxies across 190+ countries

 [Facebook scraper on GitHub](https://github.com/scrapfly/scrapfly-scrapers/tree/main/facebook-scraper) [How to scrape Facebook](https://scrapfly.io/blog/posts/how-to-scrape-facebook) [All scraper pages](https://scrapfly.io/scrapers) 

 

 [Get free API key](https://scrapfly.io/register) [Read the docs](https://scrapfly.io/docs/scrape-api/javascript-rendering)