Skip to content

Instantly share code, notes, and snippets.

@zerobase
Created November 18, 2012 20:26
Show Gist options
  • Save zerobase/4107218 to your computer and use it in GitHub Desktop.
Save zerobase/4107218 to your computer and use it in GitHub Desktop.
Booklog API (limit 100 items?)
require 'open-uri'
require 'json'
arg = ARGV.shift
if arg.nil?
print "usage: $0 username\n"
exit
end
username = arg.strip
api_url_fmt = "http://api.booklog.jp/json/%s?count=10000"
api_url = sprintf(api_url_fmt, username)
open(api_url) do |io|
h = JSON.load(io)
h['books'].each do |book|
print "#{book['asin']},\"#{book['title']}\"\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment