LogoAIDIR文档

社区推文

获取Twitter社区最新推文的API

社区推文

获取Twitter社区中的最新推文列表。

请求

URL: /api/twitter/community-tweets

方法: GETPOST

请求参数:

参数名类型必需描述
communityIdstring社区的唯一ID

响应

成功响应会返回社区中的最新推文列表,包括推文内容、创建时间、作者信息等,按时间倒序排序。

示例

请求示例

# GET 请求
curl --request GET \
  --url 'https://www.aidir.fun/api/twitter/community-tweets?communityId=1234567890' \
  --header 'X-API-Key: <api-key>'
 
# POST 请求
curl --request POST \
  --url 'https://www.aidir.fun/api/twitter/community-tweets' \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{
    "communityId": "1234567890"
  }'

响应示例

{
  "data": {
    "community": {
      "id": "1234567890",
      "name": "Tech Enthusiasts",
      "description": "A community for tech enthusiasts"
    },
    "tweets": {
      "instructions": [
        {
          "entries": [
            {
              "content": {
                "tweet": {
                  "id": "1512345678901234567",
                  "text": "This is a tweet in the community",
                  "created_at": "2023-04-15T14:34:12.000Z",
                  "author": {
                    "id": "9876543210",
                    "name": "Community Member",
                    "screen_name": "communitymember"
                  },
                  "favorite_count": 123,
                  "retweet_count": 45,
                  "reply_count": 6,
                  "quote_count": 2
                }
              }
            }
          ]
        }
      ]
    }
  }
}

错误响应

状态码描述
400请求参数错误,例如缺少必需的 communityId 参数
401认证失败,API密钥无效或缺失
404社区不存在或无权访问
500服务器内部错误

目录