API 文档API 端点
推文详情
获取Twitter推文详细信息的API
推文详情
获取指定Twitter推文的详细信息,包括内容、评论、转发、引用等。
请求
URL: /api/twitter/tweet-detail
方法: GET 或 POST
请求参数:
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| restId | string | 是 | 推文的唯一ID标识符 |
响应
成功响应会返回推文的详细信息,包括推文内容、创建时间、作者信息、点赞数、转发数、评论、媒体内容等。
示例
请求示例
# GET 请求
curl --request GET \
--url 'https://www.aidir.fun/api/twitter/tweet-detail?restId=1234567890' \
--header 'X-API-Key: <api-key>'
# POST 请求
curl --request POST \
--url 'https://www.aidir.fun/api/twitter/tweet-detail' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"restId": "1234567890"
}'响应示例
{
"data": {
"tweet": {
"id": "1234567890",
"rest_id": "1234567890",
"text": "This is the content of the tweet with some interesting information.",
"created_at": "2023-04-15T14:34:12.000Z",
"author": {
"id": "9876543210",
"rest_id": "9876543210",
"name": "Tweet Author",
"screen_name": "tweetauthor",
"profile_image_url": "https://pbs.twimg.com/profile_images/1234567890/avatar.jpg"
},
"favorite_count": 1234,
"retweet_count": 567,
"reply_count": 89,
"quote_count": 23,
"media": [
{
"type": "photo",
"url": "https://pbs.twimg.com/media/sample.jpg",
"width": 1200,
"height": 800
}
],
"replies": {
"entries": [
{
"content": {
"tweet": {
"id": "9876543210",
"text": "This is a reply to the main tweet",
"created_at": "2023-04-15T15:12:34.000Z",
"author": {
"id": "5432109876",
"name": "Reply Author",
"screen_name": "replyauthor"
}
}
}
}
]
}
}
}
}错误响应
| 状态码 | 描述 |
|---|---|
| 400 | 请求参数错误,例如缺少必需的 restId 参数 |
| 401 | 认证失败,API密钥无效或缺失 |
| 404 | 推文不存在或已删除 |
| 500 | 服务器内部错误 |
获取推文ID
要使用此API,您需要知道推文的restId。您可以通过以下方法获取:
- 在Twitter网页版上,推文的URL通常包含其ID,如
https://twitter.com/username/status/1234567890,其中1234567890即为推文ID - 使用其他Twitter API接口,如用户推文列表、搜索结果等,这些接口返回的数据中包含推文ID
MkSaaS文档