Skip to main content

Facebook page scraper is a python package that helps you scrape data from facebook pages.

Project description

PyPI version Python Versions Downloads Downloads Downloads

Facebook Page Scraper

Facebook Page Scraper is a Python client package/library that helps you grab Facebook page data without the hassle. Need basic stuff like page names and profile pics? Or maybe you're after business details, follower counts, and engagement stats? This Python package does it all with minimal code. Perfect for developers looking to scrape Facebook page info without wasting time. This Facebook page info scraper in Python cuts out hours of manual work and gives you clean, ready-to-use results. It handles all kinds of pages, pulls Facebook page information without login headaches, and fits right into your existing projects - whether you're building a dashboard, running analysis, or keeping tabs on competitors. Found on GitHub and PyPI, our Facebook page scraper is straightforward enough for newcomers but packed with features that make Facebook data extraction a breeze for seasoned coders too.

If you find this package useful, please support the project by giving it a star on GitHub. Your support helps in maintaining and enhancing the project!

Update

  • Version 0.0.4:
    • Fixed: Improved error handling for missing user data in page_info.py.
    • Fixed: Added proper null checks for delegate_page and profile_social_context.
    • Improved: Enhanced robustness against Facebook API structure changes.

Features:

  • Page Name & URL Extraction: Easily extract the name and URL of the Facebook page
  • Profile Picture Access: Get high-quality profile picture URLs
  • Basic Metrics: Extract likes, followers, talking count, and check-ins
  • Page Identity: Get page ID and business page status
  • Detailed Statistics: Access precise counts for likes, engagements, and visitor metrics
  • Business Information:
    • Category and classification
    • Physical address
    • Contact details (phone and email)
    • Website URL
    • Operating hours
    • Price range indicators
    • Available services
  • Rating Information: Access page ratings when available
  • Social Media Integration: Retrieve connected social media accounts
  • Simple Integration: Easy to integrate into any Python project

Installation

  • You can install this package using pip:
pip install facebook-pages-scraper
  • You can upgrade this package using pip (upgrade to the latest version):
pip install facebook-pages-scraper --upgrade
  • Using uv:
uv add facebook-pages-scraper -U

Usage

Scraping General Page Information

The following example demonstrates how to scrape general information from a Facebook page using the FacebookPageScraper class.

from facebook_page_scraper import FacebookPageScraper
from rich.pretty import pprint

def main():
    url = "https://www.facebook.com/pizzaburgbd"

    pprint(f">= Scraping URL/Username: {url}")

    page_info = FacebookPageScraper.PageInfo(url)
    pprint("Page Information:")
    pprint(page_info)
    pprint("=" * 80)

if __name__ == "__main__":
    main()

Using a for loop to scrape multiple URLs

from facebook_page_scraper import FacebookPageScraper
from rich.pretty import pprint
import time

def main():
    urls = [
        "/instagram",
        "https://www.facebook.com/facebook",
        "https://www.facebook.com/MadKingXGaming/",
        "https://www.facebook.com/LinkedIn",
        "https://www.facebook.com/pizzaburgbd"
    ]

    for url in urls:
        pprint(f">= Scraping URL/Username: {url}")

        page_info = FacebookPageScraper.PageInfo(url)
        pprint("Page Information:")
        pprint(page_info)
        pprint("=" * 80)
        time.sleep(2)


if __name__ == "__main__":
    main()

Possible output

{   'page_name': 'PizzaBurg',
│   'page_url': 'https://www.facebook.com/pizzaburgbd',
│   'profile_pic': 'https://scontent.fdac22-2.fna.fbcdn.net/v/t39.30808-1/461120046_932810008890332_7328117254384510587_n.jpg?stp=cp6_dst-jpg_s200x200_tt6&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=lMP1pZatZ90Q7kNvgEBx2nl&_nc_oc=AdhqTswSuZ36AUvf955zvso4FUy1qUvAUsTwzwik8lijO-NNmFLmxAhqyDFtGI-rllw&_nc_zt=24&_nc_ht=scontent.fdac22-2.fna&_nc_gid=ADEDzW-U1qvrumGbDCHzumc&oh=00_AYAo2NWsmCr_qa0IZc3Nwj_7K_-DVrgkuidp1PGhvXcFjg&oe=67B3145F',
│   'page_likes': '412K likes',
│   'page_followers': '614K followers',
│   'page_id': '1156899667774877',
│   'is_business_page': True,
│   'page_likes_count': '412,723',
│   'page_talking_count': '26,076',
│   'page_were_here_count': '64,824',
│   'page_category': 'Page · Fast food restaurant',
│   'page_address': 'Avenue Road Section:2 , Block: A, Avenue:1 , House: 12/1, Dhaka 1216, Dhaka, Bangladesh',
│   'page_phone': '01404-461200',
│   'page_email': 'pizzaburgofficial@gmail.com',
│   'page_website': 'pizzaburg.com',
│   'page_business_hours': 'Closed now',
│   'page_business_price': 'Price range · £',
│   'page_rating': None,
│   'page_services': 'Dine in · In-store collection',
│   'page_social_accounts': None
}

Disclaimer

⚠️ Important Notice

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 Page Scraper, you acknowledge that:

You have the right and permission to access the data you are scraping. You are solely responsible for how you use this package and for any consequences that may arise. The developers of this tool are not liable for any misuse, and it is your responsibility to ensure compliance with Facebook's rules and regulations.

Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facebook_pages_scraper-0.0.4.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

facebook_pages_scraper-0.0.4-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file facebook_pages_scraper-0.0.4.tar.gz.

File metadata

  • Download URL: facebook_pages_scraper-0.0.4.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for facebook_pages_scraper-0.0.4.tar.gz
Algorithm Hash digest
SHA256 291ef49b8377d21873725f1594898aab951c3c586b67aa51b5b20bc2ccbbdc6e
MD5 b09934b1b39a6b9a9077995cdc8e0543
BLAKE2b-256 0e9e35f4bf67ee39f3e9c31a7a5b4f587c8c118197b027942f8b555c6059c63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for facebook_pages_scraper-0.0.4.tar.gz:

Publisher: python-publish.yml on SSujitX/facebook-pages-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file facebook_pages_scraper-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for facebook_pages_scraper-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9873975a89c751161015bdec38cab2e46ac5fd904d7a319f3a54771856971d2a
MD5 c9e5e40c91b237fad33238cdcd6af62f
BLAKE2b-256 1b2824b0ae89edbac41bde62d2ab624d1516d377dfc6da498ab4a53ffa9b6119

See more details on using hashes here.

Provenance

The following attestation bundles were made for facebook_pages_scraper-0.0.4-py3-none-any.whl:

Publisher: python-publish.yml on SSujitX/facebook-pages-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page