如何透過 Bluesky 官方 AT Protocol API 擷取貼文、標籤和追蹤者
How to Scrape Bluesky Posts, Hashtags and Followers with the Official AT Protocol API
Scrape-Smith 示範如何透過 Bluesky 公開的 AT Protocol API,配合 Bluesky Scraper 將貼文、個人檔案及追蹤者資料匯出至試算表,並附有 Python 範例。
How to Scrape Bluesky Posts, Hashtags and Followers
Bluesky has grown into a real place for tech, journalism, science and politics conversations, and unlike some other networks, it has an open, documented public API: the AT Protocol. That makes it one of the friendliest platforms for social listening, research and audience analysis.
This tutorial covers what the public API offers, then uses the Bluesky Scraper to export posts, profiles and followers to a spreadsheet without code, plus a short Python example.
What you can get from the public API
Bluesky's AppView (public.api.bsky.app) serves, without login:
- Post search by keyword, hashtag, phrase or author
- Author feeds: everything a user posted
- Profiles: display name, bio, follower/following/post counts
- Followers and follows lists
- User search by name or bio
The actor wraps all of these, handles cursor pagination and flattens the nested records into rows with like, repost, reply and quote counts, hashtags, links and image URLs.
Step 1: Search a hashtag
Open the actor and click Try for free. It's prefilled with #buildinpublic and 20 items. Start it and you get rows like:
| type | authorHandle | text | likeCount | createdAt |
|---|---|---|---|---|
| post | someone.bsky.social | Build log, day 42: shipped... | 12 | 2026-10-22 |
Search supports Bluesky's syntax: #tag, "exact phrase", from:handle.bsky.social, and plain keywords. Use sort=top for the most engaged posts or latest for a chronological stream. lang=en narrows by language.
Step 2: Profiles and followers
Fill any of these fields (one handle per line):
-
authorFeeds: export a user's posts (includeRepliesto add replies). -
profiles: full profile rows. -
followersOf/followsOf: one profile row per follower or followed account. -
userSearch: find accounts by keyword, e.g.data journalist.
maxItems caps each query or handle, so a typo can't run up a bill.
Step 3: Monitor a topic daily
from apify_client import ApifyClient
import datetime
since = (datetime.date.today() - datetime.timedelta(days=1)).isoformat()
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("scrape-smith/bluesky-posts-profiles").call(run_input={
"searchQueries": ["\"your brand\"", "#yourproduct"],
"sort": "latest",
"onlyNewSince": since,
"maxItems": 500,
})
posts = [p for p in client.dataset(run["defaultDatasetId"]).iterate_items() if p.get("type") == "post"]
posts.sort(key=lambda p: p.get("likeCount", 0), reverse=True)
for p in posts[:10]:
print(p["likeCount"], p["authorHandle"], p["text"][:100], p["url"])
That's a daily "top mentions" digest in about fifteen lines.
Do I need a Bluesky login?
Usually not. Bluesky has at times restricted unauthenticated post search. If that happens, the actor can fall back to your handle plus an app password (Settings > Privacy and security > App passwords). Never use your main password. Without one, a refused request returns a free error row explaining what to add, rather than failing silently.
Use cases
- Social listening and brand monitoring.
- Hashtag and trend research for content and community teams.
- Influencer discovery: search users by bio, then export their follower counts.
- Academic research and NLP datasets.
- Archiving your own posts.
Honest limitations and etiquette
- Search results come from Bluesky's index, which may not include every post ever made, and very old posts can be harder to reach through search than through author feeds.
- Respect deletions. If you store data, refresh it rather than keeping posts people deleted, and follow Bluesky's developer guidelines and applicable privacy law.
- Follower exports of very large accounts are large; use
maxItems. - Not affiliated with Bluesky.
Cost
$0.0005 per post or profile row. The 20-post test is a cent; 1,000 posts is $0.50; 10,000 followers is $5. Error rows are free.
Wrap-up
Bluesky's open API is a gift for anyone who does social research. The Bluesky Scraper turns it into CSVs and scheduled feeds with no code. Start with the prefilled hashtag and swap in your own topics.
Scrape-Smith builds small, cheap data tools on public and official APIs.
來源:DEV Community · dev.to