Class: Karaoke::Song::LimitlessLyrics
- Inherits:
-
Base
- Object
- Base
- Karaoke::Song::LimitlessLyrics
show all
- Defined in:
- lib/karaoke/song/limitless_lyrics.rb
Instance Attribute Summary
Attributes inherited from Base
#lyrics_url
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.matches?(lyrics_url) ⇒ Boolean
6
7
8
|
# File 'lib/karaoke/song/limitless_lyrics.rb', line 6
def self.matches?(lyrics_url)
URI.parse(lyrics_url).host.end_with?("limitlesslyrics.com")
end
|
Instance Method Details
#artist ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/karaoke/song/limitless_lyrics.rb', line 10
def artist
return @artist if defined?(@artist)
el = document.css("h1").first || document.css("h2").first
return @artist = nil unless el
@artist = el.text.split(" - ", 2)[0]
end
|
#lyrics ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/karaoke/song/limitless_lyrics.rb', line 28
def lyrics
return @lyrics if defined?(@lyrics)
el = document.css("#botmid2").first
return @lyrics = nil unless el
@lyrics = clean_html(el.css("p").inner_html)
end
|
#title ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/karaoke/song/limitless_lyrics.rb', line 19
def title
return @title if defined?(@title)
el = document.css("h1").first || document.css("h2").first
return @title = nil unless el
@title = el.text.split(" - ", 2)[1]
end
|