Created
August 8, 2013 06:10
-
-
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
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
#!/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