kan*_*ane 15 reddit node.js node-request
我无法在reddit/r/redditdev上得到任何帮助,所以我希望你在stackoverflow的好人可以帮助
我正打算打电话给/ api/submit.
现在我尝试使用nodejs的请求模块调用提交
var options = {
url: 'https://oauth.reddit.com/api/submit',
method: 'POST',
headers: {
'Authorization': 'bearer '+usertoken
, 'user-agent': 'node.js'
},
json: data
}
request(options, function(error, response, body) ...
Run Code Online (Sandbox Code Playgroud)我的"数据"变量的示例如下所示:
{ api_type: 'json',
kind: 'self',
sr: 'test',
title: 'more test',
text: 'hello world',
iden: 'o6NsDh4IMCDb2To2DeUXJAgEPkB4O7uS',
captcha: 'WZRTBL' }
Run Code Online (Sandbox Code Playgroud)
但我得到了回报:
{
"jquery":[
[0, 1, "call", ["body"]],
[1, 2, "attr", "find"],
[2, 3, "call", [".status"]],
[3, 4, "attr", "hide"],
[4, 5, "call", []],
[5, 6, "attr", "html"],
[6, 7, "call", [""]],
[7, 8, "attr", "end"],
[8, 9, "call", []],
[1, 10, "attr", "captcha"],
[10, 11, "call", ["1oWOOhcicpcpdwjENw5KrR2xHRl7J0aS"]],
[1, 12, "attr", "find"],
[12, 13, "call", [".error.BAD_CAPTCHA.field-captcha"]],
[13, 14, "attr", "show"],
[14, 15, "call", []],
[15, 16, "attr", "text"],
[16, 17, "call", ["care to try these again?"]],
[17, 18, "attr", "end"],
[18, 19, "call", []]
]
}
Run Code Online (Sandbox Code Playgroud)
此外,我尝试将其作为不同的用户运行,具有足够的业力点并且不需要验证码.
我发布后,我得到了这个似乎表明成功的回复:
{
"jquery":[
[0, 1, "call", ["body"]],
[1, 2, "attr", "find"],
[2, 3, "call", [".status"]],
[3, 4, "attr", "hide"],
[4, 5, "call", []],
[5, 6, "attr", "html"],
[6, 7, "call", [""]],
[7, 8, "attr", "end"],
[8, 9, "call", []]
]
}
Run Code Online (Sandbox Code Playgroud)
但我无法在/ r/test subreddit中找到我发布的消息.
我必须完全做错事......
在浏览了与/ api/submit相关的不同文档后,我发现您错过了uh"数据"样本的字段.缺少uh需要看起来像你的错误(请参阅下面的文档)
这里有更多文档与我所说的相关:
https://github.com/reddit/reddit/wiki/API:-submit http://www.reddit.com/dev/api
| 归档时间: |
|
| 查看次数: |
787 次 |
| 最近记录: |