aboutsummaryrefslogtreecommitdiffstats
path: root/lyrics/lyricswiki.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lyrics/lyricswiki.rb')
-rwxr-xr-xlyrics/lyricswiki.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lyrics/lyricswiki.rb b/lyrics/lyricswiki.rb
new file mode 100755
index 000000000..39aa4a5b7
--- /dev/null
+++ b/lyrics/lyricswiki.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# Load lyrics from lyricswiki.org
+#
+# Author: Max Kellermann <max@duempel.org>
+#
+
+require 'uri'
+require 'net/http'
+
+url = "http://lyricwiki.org/api.php" + \
+ "?artist=#{URI.escape(ARGV[0])}&song=#{URI.escape(ARGV[1])}"
+response = Net::HTTP.get(URI.parse(url))
+
+exit(2) unless response =~ /<pre>\s*(.*?)\s*<\/pre>/im
+puts $1