Tumblr API – 如何使用NodeJS获取私人博客的post?
我得到一个名为“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); });
你应该去tumblr注册一个应用程序,去http://www.tumblr.com/oauth/apps 。
一旦你完成注册,你会得到你的api密钥。
来自http://www.tumblr.com/docs/en/api/v2 :
即使您不需要使用完全签名的OAuth请求,您也需要获取您的API密钥