Skip to main content

Facebook GraphQL Scraper - No login required, simple API to scrape public Facebook posts

Project description

whatisfacebook

Scrape public Facebook posts without login using a simple, requests-based scraper.

This project is a streamlined fork developed from the foundational work at FaustRen/facebook-graphql-scraper.

Improvements

  • Lightweight: Uses only requests to fetch user posts—no browser, Selenium, or Playwright required.
  • Focused: Removed login-dependent features to focus exclusively on public page scraping.
  • Efficient: Optimized for speed and minimal dependency overhead.

Install

pip install whatisfacebook

Quick Example

from whatisfacebook import FacebookGraphqlScraper

# Initialize the scraper
fb = FacebookGraphqlScraper()

# Get posts from a specific username with a day limit
result = fb.get_user_posts("honghotduongpho.official00", days_limit=3)

for post in result["data"]:
    print(f"Content: {post['content']}")
    print(f"Likes: {post['reaction_count']}")
    print(f"Shares: {post['share_count']}")
    print(f"Comments: {post['comment_count']}")
    print("-" * 20)

Results

The result object returns a structured dictionary containing profile info and a list of post data:

{
    "fb_username_or_userid": "Theanh28",
    "profile": ["Theanh28 Entertainment | Hanoi"],
    "data": [
        {
            "post_id": "1280910250890741",
            "post_url": "https://www.facebook.com/1280910250890741",
            "profile_name": "Theanh28 Entertainment",
            "profile_short_name": "Theanh28 Entertainment",
            "profile_id": "100069153349307",
            "profile_url": "https://www.facebook.com/100069153349307",
            "permalink": "https://www.facebook.com/reel/2132682674109999/",
            "content": "Đâu sẽ là phù hợp nhất ",
            "hashtags": [],
            "post_type": "StoryAttachmentVideoStyleRenderer",
            "number_of_media": 1,
            "media_items": [
                {
                    "id": "2132682674109999",
                    "type": "Video",
                    "thumbnail_url": "https://scontent.fsgn2-5.fna.fbcdn.net/...",
                    "video_url": "https://video.fsgn2-8.fna.fbcdn.net/..."
                }
            ],
            "creation_time": 1776095067,
            "published_at": "2026-04-13T22:44:27",
            "published_date": "2026-04-13",
            "reaction_count": 976,
            "share_count": 10,
            "comment_count": 39,
            "sub_reactions": [
                {"id": "1635855486666999", "name": "Thích", "reaction_count": 598},
                {"id": "115940658764963", "name": "Haha", "reaction_count": 362},
                {"id": "1678524932434102", "name": "Yêu thích", "reaction_count": 9},
                {"id": "908563459236466", "name": "Buồn", "reaction_count": 4},
                {"id": "478547315650144", "name": "Wow", "reaction_count": 2},
                {"id": "613557422527858", "name": "Thương thương", "reaction_count": 1}
            ]
        }
    ]
}

Extracting Additional Data

Note: If you need more data fields than what's provided in data, you can manually extract additional information from raw_data. This contains the complete raw Facebook GraphQL API responses.

result = fb.get_user_posts("page_username", days_limit=3)

# Access raw API responses for custom data extraction
for raw_response in result["raw_data"]:
    # Extract any custom fields you need
    custom_field = raw_response.get("your_custom_field")

Credits

Thank you to the original project owner FaustRen and the facebook-graphql-scraper repository for the foundational work that made this simplified version possible.

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

whatisfacebook-0.1.4.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

whatisfacebook-0.1.4-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file whatisfacebook-0.1.4.tar.gz.

File metadata

  • Download URL: whatisfacebook-0.1.4.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for whatisfacebook-0.1.4.tar.gz
Algorithm Hash digest
SHA256 422953b124b61e5eb611b14944aaed05dafed16bebbeb28a08598604525511e8
MD5 6dfd02ed84f41c8fcc617d0a98475cf7
BLAKE2b-256 72e56713c2ef5df5a8855170f0a8f1531ca751231f81cbaf07cc08537adfcb2f

See more details on using hashes here.

File details

Details for the file whatisfacebook-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for whatisfacebook-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0f82a67edad80d59712b2b8662688f79b3fb72f3affc90d06fae7b0e91f16a9d
MD5 bcccd4a1a542ec0fda7d75718dab447f
BLAKE2b-256 c10781173c64f38fc90d4d567571c51e9c5544f6815421a2321d18c65cfd9956

See more details on using hashes here.

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