Skip to content

Instantly share code, notes, and snippets.

@chreke
Created August 8, 2013 06:10
Show Gist options
  • Save chreke/6181891 to your computer and use it in GitHub Desktop.
Save chreke/6181891 to your computer and use it in GitHub Desktop.
hypem.rb, a script that will turn HypeMachine playlists into Spotify playlists, eventually
#!/usr/bin/ruby
require 'open-uri'
require 'json'
require 'pp'
# Some example URLs;
# http://hypem.com/playlist/loved/JohnyTex/json/1/data.js
# http://hypem.com/playlist/popular/3day/json/1/data.js
# http://ws.spotify.com/search/1/track.json?q=little%20talks
default_url = 'http://hypem.com/playlist/popular/3day/json/1/data.js'
url = ARGV[0] || default_url
puts "Downloading #{url}..."
response = ''
open(url) {|f| response = f.read }
puts "Finished downloading #{url}"
tracks = JSON.parse(response)
pp tracks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment