Skip to content

Instantly share code, notes, and snippets.

@nrk
Created August 20, 2008 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrk/6386 to your computer and use it in GitHub Desktop.
Save nrk/6386 to your computer and use it in GitHub Desktop.
This is the same as http://gist.github.com/6376 but written in Lua
http = require "socket.http"
require "json"
local json_res = http.request("http://staff.tumblr.com/api/read/json")
local tumblr = json.decode(string.match(json_res, "^var tumblr_api_read = (.*);%s*$"))
for _, post in ipairs(tumblr.posts) do print(post.type) end
--[[ **** OUTPUT ****
regular
regular
photo
regular
regular
link
link
photo
photo
link
photo
photo
photo
quote
photo
photo
regular
photo
regular
photo
--]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment