Facebook API

Facebook 搜索帖子 API

按关键词搜索公开的 Facebook 帖子,可选按地点筛选,返回结构化帖子记录(文本、作者、互动数据)。

US$30.00/千次请求,按请求付费,无需订阅。

fharvest festival | Facebook Search
facebook.com/search/posts?q=harvest%20festival

Riverside Community Market

Sep 26, 2024

Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.

84296 comments
LikeCommentShare
API 返回的内容items[0]
{
"id": "743920185640217",
"url": "https://www.facebook.com/riversidecommunitymarket/posts/743920185640217",
"text": "Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.",
"authorName": "Riverside Community Market",
"authorUrl": "https://www.facebook.com/riversidecommunitymarket",
"reactionCount": 842,
"commentCount": 96,
"shareCount": 213,
... 还有 8 个字段
}
可用率
99.17%
30d · 17,172 次调用
请求数
17,300
30d · 按周,近 12 周
响应时间
19.6s
中位数 · 30d

试一试

一个请求获取 Facebook 搜索帖子

requireFieldsarray
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `imagesCount` or `albumPreview`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
打开于
获取免费密钥
示例响应
免费运行只返回前 3 条结果。为密钥充值即可获得完整响应。

这个示例展示了 31 个字段中的 13 个。查看全部字段

{
  "found": true,
  "data": {
    "items": [
      {
        "id": "743920185640217",
        "url": "https://www.facebook.com/riversidecommunitymarket/posts/743920185640217",
        "text": "Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.",
        "authorName": "Riverside Community Market",
        "authorUrl": "https://www.facebook.com/riversidecommunitymarket",
        "reactionCount": 842,
        "commentCount": 96,
        "shareCount": 213,
        "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_banner.jpg",
        "createdUtc": 1727366400,
        "type": "post",
        "authorId": "187204093312",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/riverside_market_avatar.jpg",
        "imagesCount": 3,
        "reactions": {
          "like": 610,
          "love": 178,
          "care": 22,
          "haha": 9,
          "wow": 14,
          "sad": 2,
          "angry": 1
        },
        "albumPreview": [
          {
            "id": "743920182306884",
            "type": "photo",
            "url": "https://www.facebook.com/photo/?fbid=743920182306884",
            "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_1.jpg"
          },
          {
            "id": "743920182306901",
            "type": "photo",
            "url": "https://www.facebook.com/photo/?fbid=743920182306901",
            "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_2.jpg"
          }
        ]
      },
      {
        "id": "601487723190845",
        "url": "https://www.facebook.com/oldtownfarmers/posts/601487723190845",
        "text": "Harvest Festival vendor lineup is confirmed. Come say hi to us at booth 12!",
        "authorName": "Old Town Farmers Collective",
        "authorUrl": "https://www.facebook.com/oldtownfarmers",
        "reactionCount": 214,
        "commentCount": 18,
        "shareCount": 31,
        "image": "",
        "createdUtc": 1726934400,
        "type": "post",
        "authorId": "220981473052",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/oldtown_farmers_avatar.jpg",
        "imagesCount": 0,
        "reactions": {
          "like": 180,
          "love": 24,
          "care": 4,
          "haha": 3,
          "wow": 2,
          "sad": 0,
          "angry": 1
        },
        "albumPreview": []
      },
      {
        "id": "918204573110982",
        "url": "https://www.facebook.com/mapleridgeschool/posts/918204573110982",
        "text": "Our 3rd grade class made scarecrows for the Harvest Festival parade this weekend. So proud of this crew!",
        "authorName": "Maple Ridge Elementary PTA",
        "authorUrl": "https://www.facebook.com/mapleridgeschool",
        "reactionCount": 356,
        "commentCount": 42,
        "shareCount": 8,
        "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/scarecrow_parade.jpg",
        "createdUtc": 1726761600,
        "type": "post",
        "authorId": "339812065521",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/maple_ridge_avatar.jpg",
        "imagesCount": 1,
        "reactions": {
          "like": 290,
          "love": 55,
          "care": 8,
          "haha": 2,
          "wow": 1,
          "sad": 0,
          "angry": 0
        },
        "albumPreview": []
      }
    ]
  }
}

完整的参数与响应参考:这个接口的每个字段、类型和示例。

参考

一个请求,一种响应结构。

你发送的每个字段和收到的每个字段,都附有真实示例。

最近验证于 2026-11-14 · 可用率和延迟按 30d 统计

请求体

JSON,POST 到这个接口。

  • querystring

    harvest festival

    用于搜索 Facebook 帖子的关键词或短语(例如 'product launch')。

  • endDatestring

    只返回在此日期或之前发布的帖子,格式为 YYYY-MM-DD(例如 2024-12-31)。

  • limitinteger

    3

    最多返回的结果数(1-20,默认 20)。

  • locationstring

    Portland, United States

    Optional place name; include both city and country for best matches (e.g. 'Paris, France'). Uses Facebook's place filter, which favors posts tagged at that place rather than every post by people who live there, and can still return some posts from elsewhere.

  • requireFieldsarray

    Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `imagesCount` or `albumPreview`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.

  • startDatestring

    只返回在此日期或之后发布的帖子,格式为 YYYY-MM-DD(例如 2024-01-01)。

你发送。 一个简短的 JSON 请求体。显示的值只是示例,请换成你自己的。

响应

JSON,每个字段一个示例值。

each albumPreviewdata.albumPreview[]

Preview of the photos attached to the post.

  • idstring

    Numeric Facebook id of the photo, as a string.

  • imagestring

    Image URL of the photo.

  • typestring可设为必填

    Kind of attachment, e.g. "photo".

  • urlstring

    Canonical Facebook URL of the photo.

datadata
  • authorIdstring

    Numeric Facebook id of the page or profile that posted, as a string.

  • authorImagestring

    Profile picture URL of the page or profile that posted.

  • imagesCountinteger可设为必填

    Number of images attached to the post. Null when the source does not report it.

  • typestring可设为必填

    Kind of record Facebook returned, e.g. "post".

each itemdata.items[]

Matching public Facebook post records for the query. Populated whenever the provider has data for the entity.

  • authorNamestring

    Riverside Community Market

    Display name of the post's author. Empty when the upstream omits it.

  • authorUrlstring

    https://www.facebook.com/riversidecommunitymarket

    Canonical profile URL of the post's author, with tracking query params stripped. Empty when the upstream omits it.

  • commentCountinteger

    96

    Total number of comments on the post.

  • createdUtcnumber

    1727366400

    UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds.

  • idstring

    743920185640217

    The post's numeric Facebook ID, as a string. Populated whenever the provider has data for the entity.

  • imagestring

    https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_banner.jpg

    URL of the post's primary image, a signed CDN URL whose query must be kept. Empty for text-only or video posts.

  • reactionCountinteger

    842

    Total number of reactions on the post.

  • shareCountinteger

    213

    Total number of shares/reshares of the post.

  • textstring

    Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.

    The post's text/message. Empty for media-only posts with no caption.

  • urlstring

    https://www.facebook.com/riversidecommunitymarket/posts/743920185640217

    Canonical URL of the post. A post with no page path keeps the query that identifies it (permalink.php?story_fbid=...&id=...). Populated whenever the provider has data for the entity.

reactionsdata.reactions

Reaction counts on the post, broken down by reaction type.

  • angryinteger

    Angry reactions.

  • careinteger

    Care reactions.

  • hahainteger

    Haha reactions.

  • likeinteger

    Like reactions.

  • loveinteger

    Love reactions.

  • sadinteger

    Sad reactions.

  • wowinteger

    Wow reactions.

top level
  • foundboolean

    true

    Whether any matching posts were returned for the query.

  • reason"not_found"

    Present only when `found` is false, and says why there is no result. `not_found`: the source states the target does not exist, or returned nothing for it. A `found: false` answer is a successful call, not an error, and `costUsd` is what it actually cost.

你收到。 字段有名称、有类型,无论哪个数据源响应,结构都一样。

常见问题

关于 Facebook 搜索帖子 API

AnyAPI 的 Facebook 搜索帖子 API 只需一次 POST 请求 /v1/run/facebook.search_posts,就以统一格式的 JSON 返回 Facebook 数据。按关键词搜索公开的 Facebook 帖子,可选按地点筛选,返回结构化帖子记录(文本、作者、互动数据)。AnyAPI 会在 3 个数据源之间路由每个请求,某个数据源失败时自动切换。费用:每千次请求 US$30 起,以美元计价,无需订阅,也没有每月最低消费。过去 30 天,通过 AnyAPI 发起的 Facebook 搜索帖子 API 调用中有 99.2% 成功,响应时间中位数为 19.6 秒,共测量 17,172 次调用。

费用:每千次请求 US$30 起,以美元计价,无需订阅,也没有每月最低消费。你只需为一个美元钱包充值,每次调用从中扣费。部分由钱包付费的失败请求会产生处理费用,我们按成本原价转嫁,不加价;错误响应会显示收取的金额。

按关键词搜索公开的 Facebook 帖子,可选按地点筛选,返回结构化帖子记录(文本、作者、互动数据)。响应是统一格式的 JSON,外层结构与每个 AnyAPI 接口相同,所以解析另一个接口只需换一个 URL,别的都不用改。

过去 30 天,通过 AnyAPI 发起的 Facebook 搜索帖子 API 调用中有 99.2% 成功,响应时间中位数为 19.6 秒,共测量 17,172 次调用。这些是 AnyAPI 对经过网关的流量的自有测量,持续重新计算,并非公开承诺的服务等级目标。

可以。新的 AnyAPI 账户自带 US$0.10 免费余额,无需绑卡,足够调用 3 次 Facebook 搜索帖子,每次 US$0.03。

AnyAPI 会在同一个请求中依次尝试它的 3 个数据源,从最便宜的开始,所以一个数据源宕机不会让你的调用失败。

向 https://api.getanyapi.com/v1/run/facebook.search_posts 发送 POST 请求,在 “Authorization: Bearer” 请求头中放入你的 AnyAPI 密钥,并以 JSON 请求体传入参数。同一个密钥和同一个钱包适用于所有 AnyAPI 接口。

不需要。你向一个预付费的 AnyAPI 余额充值美元,每个请求从中扣费。没有月度套餐,也没有最低消费,同一个余额可用于所有 AnyAPI 接口。

有。TypeScript 用 npm 安装 @getanyapi/sdk,Python 用 pip 安装 getanyapi。两者都用同一个密钥调用所有 AnyAPI 接口,任何 HTTP 客户端也都可以。

可以。智能体可以连接 https://api.getanyapi.com/mcp 上的 AnyAPI MCP 服务器,或者向 https://api.getanyapi.com/agent/signup 发送一次无需认证的 POST 来创建自己的免费试用密钥,再通过 HTTP 调用这个接口。