def fetch_lyrics(self, artist, title): print('using lyricswiki') """Fetch lyrics from LyricsWiki.""" url = LYRICSWIKI_URL_PATTERN % (self._lw_encode(artist), self._lw_encode(title)) try: html = fetch_url(url) except HTTPError: return if not html: return lyrics = extract_text(html, "<div class='lyricbox'>") if lyrics and 'Unfortunately, we are not licensed' not in lyrics: return lyrics
def fetch_lyrics(self, artist, title): """Fetch lyrics from Lyrics.com.""" print('using lyricscom') url = URL_PATTERN % (self._lc_encode(title), self._lc_encode(artist)) html = fetch_url(url) if not html: return lyrics = extract_text(html, '<div id="lyric_space">') if not lyrics: return for not_found_str in NOT_FOUND: if not_found_str in lyrics: return parts = lyrics.split('\n---\nLyrics powered by', 1) if parts: return parts[0]