Bluesky 帖文与讨论串查看器

GET/tools/post-viewer

无需账户即可读取一条公开的 Bluesky 帖文:它的文本、计数和标记,直到根帖文的各级上层帖文及前 50 条回复,作者自己的讨论串(Markdown 格式),以及可选的 Bluesky 官方嵌入代码片段。会尊重只向已登录用户分享内容的作者的选择。消耗 3 次调用。

参数

名称位置类型描述
post (必填)querystring一个 bsky.app 帖文链接(`https://bsky.app/profile/<handle>/post/<rkey>`)或一个 `at://…/app.bsky.feed.post/…` URI。
embedqueryboolean, default false同时返回 Bluesky 的嵌入代码片段(一个 HTML 字符串)。
widthqueryinteger (220–600), default 550嵌入内容的最大宽度,以像素计,220 到 600。

响应

状态码描述正文
200工具的结果,附带其页面的规范 URL。ToolPostViewer
400查询参数无效(代码 `bad_request`)。Error
401令牌未知、已过期或已撤销(代码 `unauthorized`)。不带 `Authorization` 标头时,工具以匿名方式响应。Error
404未找到。在机器人的账户代码子域名上也会返回此结果:API 仅在主站点提供。Error
429已触发速率限制:每个 IP 受 `toolsApi`(每分钟 60 次)和 `toolsApiDaily`(每天 2,000 次)限制;使用创作者的令牌时,每个账户的两项限制均为其 10 倍。需要发起多次查询的工具,消耗不止一次调用。Error
500意外错误。Error
502工具请求的服务没有响应(代码 `upstream_error`)。Error

示例

bash
curl \
  -G \
  --data-urlencode "post=bsky.app/profile/bsky.app/post/3n22yg6lg2k2f" \
  -H "Authorization: Bearer $BLUESKY_BOT_TOKEN" \
  https://bluesky.bot/api/v1/tools/post-viewer

数据结构

Error

字段类型描述
error (必填)object
error.code (必填)string: "bad_request", "invalid_handle", "not_found", "rate_limited", "internal_error", "unauthorized", "forbidden", "conflict", "invalid_grant", "upstream_error", "insufficient_scope", "invalid_listing", "consent_required"
error.message (必填)string
error.reasonstring用于 `invalid_handle`、`invalid_listing`、`conflict` 和 `forbidden`:例如 `reserved`、`taken`、`too_long`、`no_handle`、`suspended`。
error.urlstring, uri用于 consent_required:打开此控制台页面以授权编辑个人资料。
error.fieldstring用于 `invalid_listing`:被拒绝的字段。
error.scopestring用于 `insufficient_scope`:令牌缺少的范围。
error.parameterstring无效的查询参数。
error.retryAfterSecondsinteger (1–)与 `rate_limited` 一起返回。

ToolPostViewer

字段类型描述
tool (必填)string = "post-viewer"工具的 slug。
url (必填)string该工具在 Bluesky.bot 上页面的规范 URL。
result (必填)object工具的结果。
result.status (必填)string: "post", "hidden", "gone"`post`;`hidden`:作者只向已登录用户分享,或某个内容审核标记将其隐藏(不返回其他任何内容);`gone`:作者的账户已被撤下、暂停、停用或删除。
result.reason (必填)string | null被隐藏的原因(`no_unauthenticated`、`account_label`、`post_label`)或消失的原因(`takendown`、`suspended`、`deactivated`、`deleted`);帖文正常时为 null。
result.url (必填)stringbsky.app 上的这条帖文。
result.post (必填)object | null帖文;被隐藏或已消失时为 null。
result.parents (必填)object[]上层帖文,根帖文在前;根帖文本身则为空。
result.parents[].depth (必填)integer上层帖文中根帖文为 0,直接回复为 1。
result.parents[].status (必填)string: "post", "hidden", "not_found", "blocked"`post`;`hidden`:其作者只向已登录用户分享,或某个内容审核标记将其隐藏;`not_found`:已删除;`blocked`。
result.parents[].post (必填)object | null帖文(当 `status` 为 `post` 时)。
result.replies (必填)object[]按阅读顺序(深度优先)排列的回复,最多 50 条、6 层深。
result.replies[].depth (必填)integer上层帖文中根帖文为 0,直接回复为 1。
result.replies[].status (必填)string: "post", "hidden", "not_found", "blocked"`post`;`hidden`:其作者只向已登录用户分享,或某个内容审核标记将其隐藏;`not_found`:已删除;`blocked`。
result.replies[].post (必填)object | null帖文(当 `status` 为 `post` 时)。
result.article (必填)string | null根帖文作者自己的讨论串(Markdown 格式),当它包含两条或更多帖文时;否则为 null。
result.embedHtml (必填)string | nullBluesky 的嵌入代码片段(若有请求且可用)。可原样粘贴到网页中。