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 package designed to extract comprehensive information from Facebook pages. Whether you're looking to gather general page details or delve into specific profile information, this tool simplifies the process, saving you time and effort. Easily integrate it into your projects to collect data such as page name, URL, profile picture, number of likes, followers, and more.

With Facebook Page Scraper, you can efficiently scrape Facebook page data in various formats. If you're looking for a Facebook page scraper, a Facebook page info scraper in Python, or an easy way to scrape Facebook page info, this tool has you covered. It's also ideal for developers who need to extract Facebook page information or scrape Facebook data using Python. You can even find it on GitHub and integrate it into your project seamlessly.

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.3:
    • Updated: Added extraction of additional data such as (cover photo).
    • Improved: Enhanced error handling.
    • Added: Initialization of PagePostInfo.
    • New Contributor: @olivier-saugeon made their first contribution.

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.3.tar.gz (12.4 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.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: facebook_pages_scraper-0.0.3.tar.gz
  • Upload date:
  • Size: 12.4 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.3.tar.gz
Algorithm Hash digest
SHA256 32be8df57f2c8fcdc3e7a9a1ee9f976f6d8a138918465a78c2d5229f7312b2f2
MD5 9415449d2a9474bde366ef77b1516a5e
BLAKE2b-256 0f12c55ffac5ee83083b9933ba8b509aea4c37e7967e98f3464f62e0a2600dd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for facebook_pages_scraper-0.0.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for facebook_pages_scraper-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1eddf50654db98be66744e46994b6074cb905c92cd361baf6eb4867ca20e5d53
MD5 b125f16559cc894206e5ec429af3c962
BLAKE2b-256 e0124d079da1a32919d6af4f21eb5304286ca58858d08cc84594ce6f93ca8d58

See more details on using hashes here.

Provenance

The following attestation bundles were made for facebook_pages_scraper-0.0.3-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