Skip to content

Instantly share code, notes, and snippets.

@Voker57
Created March 25, 2010 09:20
Show Gist options
  • Save Voker57/343356 to your computer and use it in GitHub Desktop.
Save Voker57/343356 to your computer and use it in GitHub Desktop.
require 'uri/http'
require 'net/http'
if ARGV.size < 2
puts "Usage: lyrics.rb <Artist> <Title>"
exit 1
end
artist = URI.escape(ARGV[0])
title = URI.escape(ARGV[1])
uri = URI::HTTP.build([nil, 'www.lyricsplugin.com', nil, '/winamp03/plugin/', "artist=#{artist}&title=#{title}", ''])
html = Net::HTTP.get(uri)
lyrics = html.scan(/<div id="lyrics">(.*?)<\/div>/m).first.first.gsub("<br />", "")
puts lyrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment