0.1.0 • Published 13 years ago
tumblrbot v0.1.0
A Hubot-compatible Tumblr API wrapper for Node.js
Install
npm install tumblrbotRequire
Use it in your Hubot script:
module.exports = (robot) ->
  tumblr = require('tumblrbot')(robot)Or use it on its own:
tumblr = require('tumblrbot')Use
# Get the latest 3 posts
tumblr.posts("funblog.tumblr.com").last 3, (data) ->
  console.log post.title for post in data.postsThe following options are available to help you filter by post type:
posts, text, quote, link, answer, video, audio, photo.
# Get the most recent video post
tumblr.video("funblog.tumblr.com").last (data) ->
  console.log data.posts[0].title
# Or use the plural form (it's just an alias)
tumblr.videos("funblog.tumblr.com").last (data) ->
  console.log data.posts[0].title
# Or get it without the array
tumblr.video("funblog.tumblr.com").one (post) ->
  console.log post.titleYou can pass any options specified in the Tumblr API:
tumblr.posts("funblog.tumblr.com").last 2, { tag: "potatoes" }, (data) ->
  console.log post.title for post in data.postsGet a random photo post:
tumblr.photo("funblog.tumblr.com").random (post) ->
  console.log post.photos[0].original_size.urlAuthentication
If process.env.HUBOT_TUMBLR_API_KEY is present, you're automatically authenticated. Sweet!
Helpful Hubot
Hubot will log errors if a request fails.
0.1.0
13 years ago
