Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCall the Reddit API (OAuth endpoints) with . The user's bearer
token is in . Every call MUST send a header or
Reddit returns . Use the OAuth host .
curl + jq$REDDIT_TOKENUser-Agent429https://oauth.reddit.combash
UA="web:cloud.acedata.connectors:v1.0 (by /u/acedatacloud)"Errors are JSON; a submit returns —
if is non-empty, show them verbatim. → token expired, re-connect.
{"json":{"errors":[...], "data":{...}}}errors401Always start by confirming identity:
bash
curl -sS -H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
"https://oauth.reddit.com/api/v1/me" | jq '{name, total_karma, link_karma}'使用调用Reddit API(OAuth端点)。用户的Bearer令牌存储在中。每一次调用都必须发送请求头,否则Reddit会返回错误。使用OAuth主机。
curl + jq$REDDIT_TOKENUser-Agent429https://oauth.reddit.combash
UA="web:cloud.acedata.connectors:v1.0 (by /u/acedatacloud)"错误信息为JSON格式;提交操作会返回——如果不为空,请直接显示这些错误信息。错误表示令牌过期,需要重新连接。
{"json":{"errors":[...], "data":{...}}}errors401始终先确认身份:
bash
curl -sS -H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
"https://oauth.reddit.com/api/v1/me" | jq '{name, total_karma, link_karma}'Submit a post
提交帖子
Confirm the subreddit + title + body with the user first. is the
subreddit name WITHOUT the prefix.
srr/bash
undefined请先与用户确认子版块+标题+正文内容。是子版块名称,不要包含前缀。
srr/bash
undefinedSelf (text) post: kind=self + text. Link post: kind=link + url.
纯文本帖子:kind=self + text。链接帖子:kind=link + url。
curl -sS -X POST "https://oauth.reddit.com/api/submit"
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA"
--data-urlencode "sr=test"
--data-urlencode "kind=self"
--data-urlencode "title=My title"
--data-urlencode "text=My self-post body in markdown"
--data-urlencode "api_type=json"
| jq '.json | {errors, url: .data.url, id: .data.id}'
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA"
--data-urlencode "sr=test"
--data-urlencode "kind=self"
--data-urlencode "title=My title"
--data-urlencode "text=My self-post body in markdown"
--data-urlencode "api_type=json"
| jq '.json | {errors, url: .data.url, id: .data.id}'
For a link post:
```bash
curl -sS -X POST "https://oauth.reddit.com/api/submit" \
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
--data-urlencode "sr=test" --data-urlencode "kind=link" \
--data-urlencode "title=My title" --data-urlencode "url=https://example.com" \
--data-urlencode "api_type=json" | jq '.json'curl -sS -X POST "https://oauth.reddit.com/api/submit"
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA"
--data-urlencode "sr=test"
--data-urlencode "kind=self"
--data-urlencode "title=My title"
--data-urlencode "text=My self-post body in markdown"
--data-urlencode "api_type=json"
| jq '.json | {errors, url: .data.url, id: .data.id}'
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA"
--data-urlencode "sr=test"
--data-urlencode "kind=self"
--data-urlencode "title=My title"
--data-urlencode "text=My self-post body in markdown"
--data-urlencode "api_type=json"
| jq '.json | {errors, url: .data.url, id: .data.id}'
如果是链接帖子:
```bash
curl -sS -X POST "https://oauth.reddit.com/api/submit" \
-H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
--data-urlencode "sr=test" --data-urlencode "kind=link" \
--data-urlencode "title=My title" --data-urlencode "url=https://example.com" \
--data-urlencode "api_type=json" | jq '.json'Read my submissions
查看我的已提交内容
bash
curl -sS -H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
"https://oauth.reddit.com/user/USERNAME/submitted?limit=10" \
| jq '.data.children[] | .data | {title, subreddit, ups, num_comments, permalink}'bash
curl -sS -H "Authorization: Bearer $REDDIT_TOKEN" -H "User-Agent: $UA" \
"https://oauth.reddit.com/user/USERNAME/submitted?limit=10" \
| jq '.data.children[] | .data | {title, subreddit, ups, num_comments, permalink}'Gotchas
注意事项
- User-Agent is mandatory on every request — omitting it → .
429 - Many subreddits gate posting on account age / karma / flair; a submit can
return like
errors— surface it and try[["SUBREDDIT_NOTALLOWED", ...]]to validate the flow.r/test - Respect rate limits: read the response header; space out bulk submits.
X-Ratelimit-Remaining - Use as a safe target when validating that the connection works.
r/test
- 每次请求都必须携带User-Agent——省略它会返回错误。
429 - 许多子版块对发帖有账号时长/ karma值/ flair标识的限制;提交操作可能会返回类似的错误信息——请显示该错误,并尝试使用
[["SUBREDDIT_NOTALLOWED", ...]]子版块来验证流程是否正常。r/test - 遵守速率限制:读取响应头中的字段;批量提交时请间隔执行。
X-Ratelimit-Remaining - 验证连接是否正常时,请使用作为安全测试目标。
r/test
Record the output
记录输出结果
After you successfully publish and obtain the live result URL, call the built-in
tool ONCE so the user can track this deliverable in My Outputs:
publish_artifactpublish_artifact(kind="message", channel="reddit", title="<title>", url="<the REAL returned URL>", status="delivered")Use the real returned URL — never fabricate one. Call it once per published item,
only after delivery is confirmed; skip it (or use ) if publishing failed.
See .
status="failed"_shared/artifacts.md成功发布并获取到有效的结果URL后,调用内置的工具一次,以便用户可以在我的输出中跟踪该交付成果:
publish_artifactpublish_artifact(kind="message", channel="reddit", title="<title>", url="<the REAL returned URL>", status="delivered")请使用实际返回的URL——切勿伪造。每发布一个内容调用一次该工具,且仅在确认发布成功后调用;如果发布失败,请跳过调用(或使用)。详情请查看。
status="failed"_shared/artifacts.md