Skip to main content

PyPI version Python >=3.11 Downloads Downloads this week

Facebook Pages Scraper

Facebook Pages Scraper

Facebook Pages Scraper reads public Facebook page info and the latest post without a browser or an API key. If you find it useful, please support the package by hitting the star on GitHub. Your support helps keep the project going.

Use facebook-pages-scraper for a page name, intro, about text, contact fields, and the latest post. A string returns one result. A list returns one result per page. Works with pip install facebook-pages-scraper or uv add facebook-pages-scraper on Python 3.11+.

Looking for a sponsor

ssujitxx@gmail.com

Demo

Scrape a Facebook page

How it works

The package fetches the public page HTML with a Chrome-like client, then reads the JSON Facebook embeds in that document.

Page info comes from the profile header and intro cards. Address, the About paragraph, page id, and creation date come from the About tab. The first HTML document includes only the latest post.

Accepted input:

  • bbcnews
  • https://www.facebook.com/bbcnews
  • https://web.facebook.com/bbcnews
  • https://m.facebook.com/bbcnews

pizzaburgbd is a public page that fills the About fields: intro, about text, address, phone, email, website, hours, services, Instagram, owner, page id, and creation date. Use it when you want a test run to show a full result. Page likes and the Monday–Sunday hours grid are still absent, because Facebook does not put them in this HTML.

A string returns one dict (or one list of posts). A list returns one result per page, in order. A failed page is None.

page_social_accounts is a map of network to link, for example {"Instagram": "https://www.instagram.com/meta"}. Page likes are often missing from the public HTML. page_business_hours is the open/closed line Facebook sends with the page, not the Monday–Sunday grid.

Installation

uv add facebook-pages-scraper
pip install facebook-pages-scraper
pip install facebook-pages-scraper --upgrade

This repo uses uv:

uv sync --group dev

Parameters

Parameter Default What it is
url required One page URL or username, or a list of them.
proxy None Optional HTTP/HTTPS/SOCKS5 proxy if this IP is rate-limited.
concurrency 4 Async list only. Max pages fetched at once.

proxy stays None unless you need one. Examples:

http://user:pass@host:port
https://host:port
socks5://user:pass@host:port

Usage

Sync — PageInfo

from facebook_page_scraper import FacebookPageScraper


def main():
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    url = "https://web.facebook.com/pizzaburgbd"

    try:
        page = FacebookPageScraper.PageInfo(url, proxy=proxy)
        if page:
            print(page)
        else:
            print("Error: no page data")
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

Async — PageInfoAsync

import asyncio

from facebook_page_scraper import FacebookPageScraper


def main():
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    url = "https://web.facebook.com/pizzaburgbd"

    try:
        page = asyncio.run(FacebookPageScraper.PageInfoAsync(url, proxy=proxy))
        if page:
            print(page)
        else:
            print("Error: no page data")
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

Async batch

Pass a list. Up to concurrency pages run at once.

import asyncio

from facebook_page_scraper import FacebookPageScraper


def main():
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    urls = [
        "https://web.facebook.com/pizzaburgbd",
        "https://web.facebook.com/NASA",
        "https://web.facebook.com/Meta",
    ]

    try:
        pages = asyncio.run(
            FacebookPageScraper.PageInfoAsync(urls, concurrency=4, proxy=proxy)
        )
        for page in pages:
            if page:
                print("Page:", page["page_name"])
            else:
                print("Error: no page data")
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

FacebookPageScraper.PageInfo(urls) also accepts a list (sync, one page after another). For many pages, async batch is the better call.

PagePostInfo and PagePostInfoAsync take the same url, proxy, and concurrency arguments. A string returns the latest post as a one-item list. A list of pages returns a list of those lists.

Disclaimer

Facebook's Terms of Service and Community Standards prohibit unauthorized scraping of their platform. This package is intended for educational purposes, and you should use it in compliance with Facebook's policies. Unauthorized scraping or accessing Facebook data without permission can result in legal consequences or a permanent ban from the platform.

By using Facebook Pages Scraper, you acknowledge that you have the right to access the data you are scraping, and that you are solely responsible for how you use this package. The developers of this tool are not liable for any misuse.

Star History

Star History Chart

Visitors

Metadata

Release files for facebook-pages-scraper 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for facebook-pages-scraper 0.0.6
File Size Uploaded
facebook_pages_scraper-0.0.6.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for facebook-pages-scraper 0.0.6
File Interpreter ABI Platform
facebook_pages_scraper-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / facebook_pages_scraper-0.0.6.tar.gz

Download URL facebook_pages_scraper-0.0.6.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09d5bfab3bca8e58e27e3553a72fb64f2f15b73c137f66dd70c8055c5c1a51e8
BLAKE2b-256 checksum
How to use checksums
a2cb1058861116186f79a2826d4f76e32654781c7f6e3810d6ba2979b82620c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / facebook_pages_scraper-0.0.6-py3-none-any.whl

Download URL facebook_pages_scraper-0.0.6-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccb2c99fb48c0131c5f628b470546f1650560dbc33423ac7c50fd51cd1498582
BLAKE2b-256 checksum
How to use checksums
f0d4307c305e0532588341c1b09ee10d727f88281b623af28b61d06288676b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page