3 Scraper for https://lrclib.net/
7 https://github.com/rtcq/syncedlyrics
23 self.
SEARCH_URL =
'https://lrclib.net/api/search?q=%s-%s'
27 log(
"%s: searching lyrics for %s - %s" % (__title__, song.artist, song.title), debug=self.
DEBUG)
28 lyrics = Lyrics(settings=self.
settings)
30 lyrics.source = __title__
33 url = self.
SEARCH_URL % (song.artist, song.title)
34 response = requests.get(url, timeout=10)
35 result = response.json()
40 artistname = item[
'artistName']
41 songtitle = item[
'name']
43 if (difflib.SequenceMatcher(
None, song.artist.lower(), artistname.lower()).ratio() > 0.8)
and (difflib.SequenceMatcher(
None, song.title.lower(), songtitle.lower()).ratio() > 0.8):
44 links.append((artistname +
' - ' + songtitle, self.
LYRIC_URL % songid, artistname, songtitle))
57 title,url,artist,song = link
59 log(
'%s: search url: %s' % (__title__, url), debug=self.
DEBUG)
60 response = requests.get(url, timeout=10)
61 result = response.json()
64 if 'syncedLyrics' in result:
65 lyrics = result[
'syncedLyrics']