# from https://gist.github.com/Sidysky/11354662 require 'open-uri' puts "Artist:" artist = $stdin.gets.chomp artist = artist.delete " " puts "Song Name:" song = $stdin.gets.chomp song = song.delete " " url = "http://www.azlyrics.com/lyrics/" url << artist.downcase url << "/" url << song.downcase.gsub("'", '') # gsub to remove single quotes from song title url << ".html" puts url page_content = open(url).read debut = page_content.index('') fin = page_content.index('

') debut = debut + 133 fin = fin - 11 lyrics = page_content[debut..fin] lyrics = lyrics.gsub "
", " " puts lyrics