Skip to content

Instantly share code, notes, and snippets.

@ktnyt
Created December 26, 2013 08:35
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 ktnyt/8131300 to your computer and use it in GitHub Desktop.
Save ktnyt/8131300 to your computer and use it in GitHub Desktop.
Parsing bus api output with ruby
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
url = 'http://hack.sfc.keioac.jp/sfcbusapi/index.php'
uri = URI.parse( url )
res = Net::HTTP.get( uri )
m = /^callback\((.+)\);$/.match( res )
data = JSON.parse( m[1] )
puts data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment