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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for whatisfacebook-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b785828fd7ffdff58045d07fbe90baba9c5ed0a530d814f9f2378ac7fbce3276
MD5 793fd6b9072bbca012392ba43745b3ad
BLAKE2b-256 5a76274752c23547c1ec04ec550d859fa66dfa8dfa0a0ee00bda15e509b2b647

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for whatisfacebook-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b0b5be95fd4169070269e3f071e79cc200151ee1c9eb214a69afda5f79b421d2
MD5 c16404d071cbdbcbd9cee1efb2d9315f
BLAKE2b-256 d823a4db8691b90bee64baf68c013b56c3fcab59479c1c2935e9283322b514d6

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