X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/f2ec7254120c90c3b023687f67a7b19f78b69370..f1f1106951c4acf88e28555415d39e249a3d13f6:/lib/lyricli/lyrics_engine.rb diff --git a/lib/lyricli/lyrics_engine.rb b/lib/lyricli/lyrics_engine.rb index beacd46..1291d41 100644 --- a/lib/lyricli/lyrics_engine.rb +++ b/lib/lyricli/lyrics_engine.rb @@ -24,18 +24,22 @@ module Lyricli doc = Nokogiri::HTML(open(response['url'])) node = doc.search(".lyricbox").first rescue - raise Lyricli::LyricsNotFoundException + raise Exceptions::LyricsNotFoundError end node.search(".rtMatcher").each do |n| n.remove end + node.search("script").each do |n| + n.remove + end + node.search("br").each do |br| br.replace "\n" end - node.inner_text + node.inner_text.gsub(/\s+$/, "") end end end