我得到了一个名为"tumblrwks"的库(https://github.com/arkxu/tumblrwks),它使用nodejs连接到tumblr API并且可以正常工作,但问题是我想从一个私人博客中获取数据,因此我需要OAuth请求。
我如何在Tumblr中获取OAuth(oauth_token和oauth_secret)?
这是我想用OAuth完成的代码,请帮忙。
var Tumblr = require('tumblrwks');
/*
You can get the consumerKey and consumerSecret by registing a tumblr app: http://www.tumblr.com/oauth/apps
*/
var tumblr = new Tumblr(
{
consumerKey: 'YOUR_CONSUMER_KEY',
consumerSecret: 'YOUR_CONSUMER_SECRET',
accessToken: 'ACCESS_TOKEN',
accessSecret: 'ACCESS_SECRET'
}, "void2012.tumblr.com"
// specify the blog url now or the time you want to use
);
tumblr.get('/info', {hostname: 'void2012.tumblr.com'}, function(json){
console.log(json);
});