Reddit API - 帖子详情 (V1)
通过其唯一ID检索特定Reddit帖子的全面信息。包括帖子内容(文本或链接)、作者详情、子版块信息以及参与度统计数据,如点赞、点踩和评论数。
典型用例:
- 品牌、产品或主题的情感分析
- 跟踪公众对特定内容的参与度
- 内容归档和元数据分析
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | 此 API 服务的访问令牌。 |
postId | query | string | 是 | Reddit帖子的唯一标识符(例如't3_1q4aqti')。 |
代码示例
💡 环境说明
默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择。
bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE"text
我想使用 Just One API 提供的“帖子详情 (V1)”接口。
接口地址: https://api.justoneapi.com/api/reddit/get-post-detail/v1
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/reddit-apis/post-details-v1-zh.json
请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- postId (query): Reddit帖子的唯一标识符(例如't3_1q4aqti')。 (必填)
返回格式: JSON
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 余额不足
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE"
response = requests.get(url)
print(response.json())js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/reddit/get-post-detail/v1?token=YOUR_API_KEY&postId=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;响应结果
json
{
"code": 0,
"data": {
"postsInfoByIds": [
{
"__typename": "SubredditPost",
"authorCommunityBadge": null,
"subreddit": {
"__typename": "Subreddit",
"id": "t5_2x2oy",
"name": "Whatcouldgowrong",
"prefixedName": "r/Whatcouldgowrong",
"isQuarantined": false,
"title": "What Could Possibly Go Wrong?",
"type": "PUBLIC",
"subscribersCount": 7849923,
"isNsfw": false,
"isSubscribed": false,
"isThumbnailsEnabled": true,
"styles": {
"icon": null,
"legacyIcon": {
"url": "https://a.thumbs.redditmedia.com/wk4DdnifrZxOjoVTiBzk1jsK8RqACLAQi6TO4JMxCx0.png"
},
"primaryColor": "#B8001F",
"backgroundColor": null,
"bannerBackgroundImage": "https://styles.redditmedia.com/t5_2x2oy/styles/bannerBackgroundImage_noc56x5mbi821.png",
"legacyPrimaryColor": "#222222"
},
"modPermissions": null,
"communityStatus": null,
"isTitleSafe": true,
"isUserBanned": false,
"tippingStatus": null,
"whitelistStatus": "ALL_ADS"
},
"crosspostRoot": null,
"id": "t3_1q4aqti",
"createdAt": "2026-01-05T03:30:19.779000+0000",
"editedAt": null,
"postTitle": "[ 已被版主删除 ]",
"url": "https://www.reddit.com/r/Whatcouldgowrong/comments/1q4aqti/%E5%B7%B2%E8%A2%AB%E7%89%88%E4%B8%BB%E5%88%A0%E9%99%A4/",
"content": null,
"domain": "v.redd.it",
"isSpoiler": false,
"isNsfw": false,
"isCommercialCommunication": false,
"isLocked": true,
"isSaved": false,
"isReactAllowed": false,
"isHidden": false,
"isGildable": false,
"isCrosspostable": false,
"isScoreHidden": false,
"isArchived": false,
"isStickied": false,
"isPollIncluded": false,
"poll": null,
"isFollowed": false,
"awardingsInfo": null,
"awardings": [
{
"__typename": "AwardingTotal",
"award": {
"__typename": "Award",
"id": "award_free_popcorn_2",
"name": "吃瓜",
"tags": [
"award:legacy",
"award:unlimited_free",
"award:sort:50",
"award:quick_give"
],
"static_icon_16": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/snoo_assets/marketing/Popcorn_16.png",
"dimensions": {
"width": 16,
"height": 16
}
},
"static_icon_24": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/snoo_assets/marketing/Popcorn_24.png",
"dimensions": {
"width": 24,
"height": 24
}
},
"static_icon_32": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/snoo_assets/marketing/Popcorn_32.png",
"dimensions": {
"width": 32,
"height": 32
}
},
"static_icon_48": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/snoo_assets/marketing/Popcorn_48.png",
"dimensions": {
"width": 48,
"height": 48
}
},
"static_icon_64": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/snoo_assets/marketing/Popcorn_64.png",
"dimensions": {
"width": 64,
"height": 64
}
}
},
"total": 5
}
],
"isContestMode": false,
"distinguishedAs": null,
"voteState": "NONE",
"score": 32609,
"commentCount": 717,
"viewCount": null,
"authorFlair": null,
"flair": null,
"authorInfo": {
"__typename": "Redditor",
"id": "t2_144icfdwdo",
"name": "goswamitulsidas",
"isBlocked": false,
"isCakeDayNow": false,
"newIcon": {
"__typename": "MediaSource",
"url": "https://preview.redd.it/snoovatar/avatars/495a64a3-a7b9-4289-90a8-8bba16564b1b-headshot.png?auto=webp&s=fe2ac439bb6f9d827747f37a05dac029a8fce7a5",
"dimensions": {
"width": 256,
"height": 256
}
},
"iconSmall": {
"__typename": "MediaSource",
"url": "https://preview.redd.it/snoovatar/avatars/495a64a3-a7b9-4289-90a8-8bba16564b1b-headshot.png?width=50&height=50&auto=webp&s=8fbe87c6a54b0bb02d1fbd4c2289ec0698f23003",
"dimensions": {
"width": 50,
"height": 50
}
},
"snoovatarIcon": {
"__typename": "MediaSource",
"url": "https://i.redd.it/snoovatar/avatars/495a64a3-a7b9-4289-90a8-8bba16564b1b.png",
"dimensions": {
"width": 380,
"height": 600
}
},
"profile": {
"isNsfw": false
},
"accountType": "USER"
},
"isThumbnailEnabled": true,
"thumbnail": null,
"media": null,
"moderationInfo": null,
"suggestedCommentSort": "TOP",
"permalink": "/r/Whatcouldgowrong/comments/1q4aqti/已被版主删除/",
"isSelfPost": false,
"postHint": null,
"postEventInfo": null,
"gallery": null,
"devvit": null,
"outboundLink": {
"url": "https://www.reddit.com/r/Whatcouldgowrong/comments/1q4aqti/%E5%B7%B2%E8%A2%AB%E7%89%88%E4%B8%BB%E5%88%A0%E9%99%A4/",
"expiresAt": "2026-03-09T19:21:08.596449+0000"
},
"postStats": {
"viewCountTotal": null,
"shareAllTotal": 3233
},
"postStatsPrivate": {
"viewCountTotals": null
},
"isAuthorBlocked": false,
"upvoteRatio": 0.9703780024470345,
"reactedFrom": null,
"attributionInfo": null,
"crowdControlLevel": "OFF",
"isCrowdControlFilterEnabled": false,
"languageCode": "en",
"isTranslatable": false,
"isTranslated": false,
"translatedLanguage": null,
"removedByCategory": "MODERATOR",
"modContentDiscussion": null,
"predictedRemovalSavedResponses": []
}
]
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
