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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for whatisfacebook-0.1.6.tar.gz
Algorithm Hash digest
SHA256 20045149be5e1664604ef136553c01ab2a015b204e552bc7bdf029348e176af8
MD5 e619b6b31dc25db2b607ed7134debfc0
BLAKE2b-256 4648698672e2ad1e47886dcc4d7ea3f8700bba421c03d907d59281588172083f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for whatisfacebook-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7c7bd6ce5a00b6a9e6c101263e50beb858d92ccb654f929dc75dab92301bd194
MD5 ad18d16a168300f4c16ff54098ca8804
BLAKE2b-256 56097aba1d84f6249e1d82e48889f1c9a0a0182a58f409bfdb30f973dc23926b

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