10 __title__ =
'supermusic'
21 log(
'%s: searching lyrics for %s - %s' % (__title__, song.artist, song.title), debug=self.
DEBUG)
22 lyrics = Lyrics(settings=self.
settings)
24 lyrics.source = __title__
26 artist = song.artist.lower()
27 title = song.title.lower()
30 req = requests.post(
'https://supermusic.cz/najdi.php', data={
'hladane': title,
'typhladania':
'piesen',
'fraza':
'off'})
37 items = re.search(
r'Počet nájdených piesní.+<br><br>(.*)<BR>', response, re.S).group(1)
38 for match
in re.finditer(
r'<a href=(?P<url>"[^"]+?") target="_parent"><b>(?P<artist>.*?)</b></a> - (?P<type>.+?) \(<a href', items):
39 matched_url, matched_artist, matched_type = match.groups()
40 if matched_type
not in (
'text',
'akordy a text'):
42 if matched_artist.lower() == artist:
43 url = matched_url.strip(
'"')
52 req = requests.get(
'https://supermusic.cz/%s' % url)
54 lyr = re.search(
r'class=piesen>(.*?)</font>', response, re.S).group(1)
55 lyr = re.sub(
r'<sup>.*?</sup>',
'', lyr)
56 lyr = re.sub(
r'<br\s*/>\s*',
'\n', lyr)
57 lyr = re.sub(
r'<!--.*?-->',
'', lyr, flags=re.DOTALL)
58 lyr = re.sub(
r'<[^>]*?>',
'', lyr, flags=re.DOTALL)
59 lyr = lyr.strip(
'\r\n')
60 lyr = html.unescape(lyr)