8__title__ =
'lyricsmode'
18 log(
'%s: searching lyrics for %s - %s' % (__title__, song.artist, song.title), debug=self.
DEBUG)
19 lyrics = Lyrics(settings=self.
settings)
21 lyrics.source = __title__
25 url =
'http://www.lyricsmode.com/lyrics/%s/%s/%s.html' % (artist.lower()[:1], artist.lower().replace(
'&',
'and').replace(
' ',
'_'), title.lower().replace(
'&',
'and').replace(
' ',
'_'))
30 lyr = result.split(
'style="position: relative;">')[1].split(
'<div')[0]
31 lyrics.lyrics = lyr.replace(
'<br />',
'')
36 log(
'%s: direct url: %s' % (__title__, url), debug=self.
DEBUG)
37 song_search = requests.get(url, timeout=10)
38 response = song_search.text
39 if response.find(
'lyrics_text') >= 0:
42 log(
'error in direct url', debug=self.
DEBUG)
46 url =
'http://www.lyricsmode.com/search.php?search=' + urllib.parse.quote_plus(artist.lower() +
' ' + title.lower())
47 log(
'%s: search url: %s' % (__title__, url), debug=self.
DEBUG)
48 song_search = requests.get(url, timeout=10)
49 response = song_search.text
50 matchcode = re.search(
'lm-list__cell-title">.*?<a href="(.*?)" class="lm-link lm-link--primary', response, flags=re.DOTALL)
52 url =
'http://www.lyricsmode.com' + (matchcode.group(1))
59 log(
'error in search url', debug=self.
DEBUG)
def direct_url(self, url)
def search_url(self, artist, title)
def get_lyrics(self, song)
def __init__(self, *args, **kwargs)
None log(str msg, int level=LOGDEBUG)