Created
August 20, 2008 14:32
-
-
Save nrk/6376 to your computer and use it in GitHub Desktop.
Parsing posts from tumblr using JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parsing posts from tumblr using JSON | |
JSON | |
Regex | |
Map squareBrackets := method( | |
return self at(call evalArgs at(0)) | |
) | |
URL with("http://staff.tumblr.com/api/read/json") fetch findRegex("^var tumblr_api_read = (.*);\s*$") ?at(1) fromJSON ["posts"] foreach(post, post ["type"] println) | |
/* | |
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