How to Scrape Facebook Hashtags (2026)
- I sent a plain
requests.gettofacebook.com/hashtag/marketingin July 2026. With a Chrome User-Agent it returned HTTP 400 and a 1,542-byte page titledError. With no User-Agent the same URL returned HTTP 302, a redirect to a login checkpoint. A hashtag feed is gated harder than a public Page. - A Facebook hashtag feed at
/hashtag/<tag>aggregates public posts that carry that tag, from Pages, public Groups, and public profiles: author, text, timestamp, reactions, comments, and shares. - There is no Facebook hashtag search API. The Instagram Graph API has
ig_hashtag_search, but it is Instagram-only and account-scoped, so the working routes for Facebook are a logged-in browser (Playwright) or a scraper API that takes the hashtag URL and returns JSON. - Logged-off scraping of public Facebook data survived Meta v. Bright Data in January 2024. A logged-in hashtag scrape is a separate legal question, covered at the end.
I went looking for how to scrape Facebook hashtags the direct way first: one requests.get against facebook.com/hashtag/marketing, expecting the feed of public posts that carry that tag. With a normal Chrome User-Agent it came back HTTP 400 and a 1,542-byte page whose <title> is literally Error. I removed the User-Agent and the same URL returned HTTP 302, a redirect to a login checkpoint. Neither result is the tagged feed you want, and that gap is what this guide is about.
Below is exactly what I ran in July 2026, why a hashtag feed is harder to reach than a public Page, whether any official API covers it, and the two routes that actually return posts under a tag.
What data can you scrape from a Facebook hashtag?
A Facebook hashtag feed lives at facebook.com/hashtag/<tag> and aggregates public posts that contain that tag, drawn from Pages, public Groups, and public profiles. When it renders, each post in the feed carries the fields you would expect from any Facebook post: author name and profile link, the post text, a timestamp, the permalink, and the engagement counts (reactions, comments, and shares).
That is the same shape managed hashtag scrapers return. Apify’s and Bright Data’s Facebook hashtag tools both output a row per post with post ID, content, date posted, URL, and the like, comment, and share counts, plus poster name and profile picture. So the target schema is stable and well understood. The hard part is never parsing the data. It is landing on the feed at all, which is where the next section starts.
| Route | Auth | What it returns | Main limit |
|---|---|---|---|
| Logged-out HTML request | None | HTTP 400 or a 302 redirect, no feed | Hashtag surface is gated |
| Logged-in browser (Playwright) | Your cookies | Rendered post cards under the tag | Brittle, ToS exposure, one IP |
| Scraper API | API key | Parsed JSON posts from the tag URL | Per-request cost |
Why is scraping Facebook hashtags harder than a public Page?
Scraping a Facebook hashtag is harder than a public Page because the hashtag surface returns no usable logged-out HTML, where a Page leaks some public data even without a login. I confirmed the split in July 2026 by sending the same three requests to a Page and to a hashtag URL:
| Request | User-Agent | Page (/Meta) | Hashtag (/hashtag/marketing) |
|---|---|---|---|
GET | Desktop Chrome string | 400, Error page | 400, 1,542-byte Error page |
GET | none | 200, 472 KB shell | 302, redirect to login |
The Page returned a 200 shell with the name and like count sitting in its og: meta tags. The hashtag URL gave me a 400 with a browser User-Agent and a 302 redirect with none, so there was no public markup to parse either way. A hashtag feed is also assembled entirely in JavaScript after an authenticated session loads, and it lazy-loads more posts as you scroll, so even once you are past the gate a single HTTP response holds almost nothing. Those two facts, the login gate and the client-side rendering, decide every method below. Before the manual route, it is worth checking whether an official API sidesteps all of it.
Is there an official Facebook hashtag API?
There is no official Facebook hashtag API. Facebook’s Graph API exposes Pages, accounts, and ads you own or are approved for, and it has no endpoint that searches or lists posts by hashtag. The one hashtag search Meta ships belongs to Instagram: the IG Hashtag Search endpoint resolves a tag to an ID and returns its recent_media and top_media, but it only covers Instagram, only for Business and Creator accounts, and it limits you to roughly 30 unique hashtags in a rolling 7-day window.
None of that reaches a Facebook post. So the official-API answer for Facebook hashtags is a flat no, and the working methods are the same two that cover every other gated Facebook surface: drive a logged-in browser yourself, or send the hashtag URL to a scraper API that runs the browser for you. The manual route comes first.
How do you scrape Facebook hashtags with Python?
You scrape Facebook hashtags with Python by loading a logged-in session in a headless browser, opening the /hashtag/<tag> URL, scrolling to trigger the lazy-loaded posts, and parsing the rendered cards. A plain requests call cannot do it, and it is worth running once so you recognize the wall in your own logs:
import requests
UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/126.0.0.0 Safari/537.36")
# Logged out, July 2026. A desktop Chrome UA returns HTTP 400 on the hashtag URL.
r = requests.get(
"https://www.facebook.com/hashtag/marketing",
headers={"User-Agent": UA},
timeout=20,
allow_redirects=False,
)
print(r.status_code) # -> 400
print(len(r.content), "bytes") # -> 1542 (an "Error" page, no feed)
Dropping the User-Agent header flips the 400 to a 302 redirect toward a login checkpoint, so neither variant returns the tagged posts. To reach the feed you need an authenticated browser. The pattern I use is Playwright with a saved login state, so I log in once by hand, store the session, and reuse it:
from playwright.sync_api import sync_playwright
TAG = "marketing"
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
# storage_state is a session saved once from a real login.
ctx = browser.new_context(storage_state="fb_state.json")
page = ctx.new_page()
page.goto(f"https://www.facebook.com/hashtag/{TAG}")
page.wait_for_selector('[role="article"]', timeout=15000)
# Lazy-loaded feed: scroll to pull more posts into the DOM.
for _ in range(6):
page.mouse.wheel(0, 4000)
page.wait_for_timeout(2000)
posts = page.query_selector_all('[role="article"]')
print("rendered post cards:", len(posts))
for card in posts:
text = card.inner_text().replace("\n", " ")
print(text[:120])
browser.close()
This renders the feed and it is the most brittle option on the list. Facebook obfuscates and reshuffles its class names, so the [role="article"] selector needs babysitting, and the same data the JavaScript builds also sits in an embedded JSON blob in the markup, which some teams parse instead because it survives cosmetic churn a little better. Two costs come with this route regardless of selector strategy. You are now logged in, so Meta’s automated-collection terms apply and the ban risk lands on your own account and datacenter IP, a line I cover in the legal section. And one Chrome instance does not rotate IPs, so it flags fast at any volume. That maintenance load is the exact problem the managed route removes. The pure-Python and other-language variants sit in how to scrape Facebook with Python.
How do you scrape Facebook hashtags without getting blocked?
A scraper API takes the hashtag URL and returns parsed JSON, running the headless browser, the logged-in session, proxy rotation, and retries on its own servers. Your code sends one request. There is no Playwright to maintain, no fb_state.json to refresh, and no IP of yours to get banned, which is how I run anything past a handful of tags.
I point my code at ChocoData, which exposes Facebook endpoints under one base. The request shape is the hashtag URL plus your key:
curl "https://chocodata.com/api/v1/facebook/hashtag?url=https://www.facebook.com/hashtag/marketing&api_key=$CHOCO_API_KEY"
The same call from Python, which is what slots into a pipeline:
import os
import requests
resp = requests.get(
"https://chocodata.com/api/v1/facebook/hashtag",
params={
"url": "https://www.facebook.com/hashtag/marketing",
"api_key": os.environ["CHOCO_API_KEY"],
},
timeout=60,
)
data = resp.json()
for post in data["posts"]: # parsed post objects
print(post["author"], "-", post["text"][:60], "-", post["likes"])
When I hit that endpoint without a provisioned key in July 2026 it returned HTTP 404 NOT_FOUND, the expected response before you authenticate, the same as the /facebook/page endpoint returns bare. With a key it returns the parsed posts. Swap the path for other targets you might join to a tag pull, such as /facebook/post, /facebook/group, or /facebook/page. The free tier covers 1,000 requests, Pro pricing runs about $0.60 per 1,000 requests, pay-as-you-go top-ups are $0.90 per 1,000, and the median response is about 2.6 seconds end to end, including the residential routing and rendering. You are billed only for successful results. For a one-off look at a single tag the Playwright route is fine and free. For continuous collection across many hashtags, offloading the rendering and rotation is the cheaper path once you price in the hours you would spend fixing selectors. I rank the managed options in the best Facebook scrapers of 2026.
Is it legal to scrape Facebook hashtags?
The legality of scraping Facebook hashtags turns on one distinction: logged-off public data versus logged-in or personal data. I am an engineer and this is not legal advice, and the facts of your project matter.
For public, logged-off data, US courts have leaned toward access. In Meta Platforms v. Bright Data (N.D. Cal., January 2024), Judge Edward Chen granted summary judgment for Bright Data, and the ruling states that “the Facebook and Instagram Terms do not bar logged-off scraping of public data.” A hashtag feed is public in that sense, but as my tests showed it does not actually render logged-off, so most real hashtag pulls involve an authenticated session.
That is where the picture flips. Once you log in, whether by hand or through a saved Playwright session, you are bound by Facebook’s Automated Data Collection Terms, which prohibit using automated means to collect data without prior written permission. Two more constraints apply no matter how you collect: a hashtag feed mixes in posts from ordinary profiles, so you are likely handling personal data that privacy law such as the GDPR governs even when it is public, and you should collect only what you have a basis to process. The defensible zone is public, non-personal data at a respectful rate. For the full breakdown see is scraping Facebook legal.
What can you do with Facebook hashtag data?
Scraped Facebook hashtag data is most useful for tracking a campaign or a topic across accounts you do not own, because the tag cuts across Pages, Groups, and profiles that no single Page export would show you. Collect a tag on a schedule and dedupe on post ID, and you build a running view of who is posting under a branded or event hashtag, how often, and with what engagement.
Three uses come up most in my work. Campaign monitoring watches a branded hashtag to see reach and sentiment beyond your own Page. Competitor and category research reads which tags a market uses and which posts under them draw reactions. Lead and creator discovery surfaces the profiles and Pages posting under a niche tag. All three lean on the same collected fields, and all three sit under the same legal line above, so settle the personal-data question before you run a tag at volume.
Sources
- Meta Platforms, Inc. v. Bright Data Ltd. - N.D. Cal. ruling that Meta’s terms do not bar logged-off scraping of public data (January 2024) - https://www.leagle.com/decision/infdco20240124a35
- Meta Automated Data Collection Terms - prohibition on automated collection while logged in - https://www.facebook.com/legal/automated_data_collection_terms
- Meta for Developers, IG Hashtag Search - shows hashtag search is Instagram-only and account-scoped - https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-hashtag-search/
Schema Suggestions
- HowTo schema for the Python and API steps (naive request, Playwright render, scraper API call).
- FAQPage schema for the four Q&A pairs in the FAQ.
- Article schema with author Noah Berg, datePublished July 6 2026, dateModified July 14 2026.
FAQ
Can you scrape Facebook hashtags without logging in?
Barely. In my July 2026 test a logged-out request to facebook.com/hashtag/marketing returned either HTTP 400 (with a Chrome User-Agent) or HTTP 302, a redirect to a login checkpoint (with no User-Agent). Neither returned the feed of tagged posts. Unlike a public Page, whose og: tags leak the name and like count to a logged-out request, the hashtag surface hands back an error or a redirect, so the practical routes are a logged-in browser session or a scraper API that runs one server-side.
Does Facebook have a hashtag API?
No. Facebook's Graph API has no hashtag search endpoint. The Instagram Graph API does have one (ig_hashtag_search plus recent_media and top_media), but it only returns Instagram media, only for Business and Creator accounts, and it caps you at roughly 30 unique hashtags per rolling 7-day window. For Facebook posts under a tag there is no official API at all, which is why scraping the public hashtag URL is the route people use.
How many posts can you get from one Facebook hashtag?
Fewer than the tag's full history. The feed lazy-loads in batches as you scroll, and Facebook stops serving more after a point, so you collect a recent window rather than everything ever posted. Apify's Facebook Hashtag Scraper states it returns around 200 results per hashtag on average, which is a reasonable expectation for a single pass. For steady coverage you re-run the tag on a schedule and dedupe on post ID.
Do Facebook hashtags work like Instagram hashtags for scraping?
Not really. Hashtags are central to discovery on Instagram and TikTok, and far weaker on Facebook, where most engagement flows through Pages, Groups, and the algorithmic feed rather than tag pages. A Facebook hashtag feed still exists and still aggregates public posts, but it is thinner and more login-gated, so treat it as one signal among several rather than the primary discovery surface it is on Instagram.