summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 208909c)
raw | patch | inline | side by side (parent: 208909c)
author | Jeffrey Middleton <jefromi@gmail.com> | |
Tue, 10 Mar 2009 13:49:46 +0000 (08:49 -0500) | ||
committer | Jeffrey Middleton <jefromi@gmail.com> | |
Tue, 10 Mar 2009 13:49:46 +0000 (08:49 -0500) |
LyricWiki returns a page with "Not found" in place of the song lyrics if
the song is not found; check for this.
the song is not found; check for this.
lyrics/02-lyricwiki.rb | patch | blob | history |
diff --git a/lyrics/02-lyricwiki.rb b/lyrics/02-lyricwiki.rb
index a90cb2ae80366e82e11b0c5956d38326b55624c8..9c9f66378cd81e6dc74f03aa755586f42f436863 100755 (executable)
--- a/lyrics/02-lyricwiki.rb
+++ b/lyrics/02-lyricwiki.rb
response = Net::HTTP.get(URI.parse(url))
exit(2) unless response =~ /<pre>\s*(.*?)\s*<\/pre>/im
+exit(2) if $1 == "Not found"
puts $1