Fix intermittent failures of the Genius fetcher

This commit is contained in:
Andrzej Rybczak
2020-12-21 01:00:22 +01:00
parent ba2a4533ab
commit 37af7d8052
3 changed files with 6 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
# ncmpcpp-0.10 (????-??-??) # ncmpcpp-0.10 (????-??-??)
* Add support for fetching lyrics from musixmatch.com. * Add support for fetching lyrics from musixmatch.com.
* Fix intermittent failures of the Genius fetcher.
# ncmpcpp-0.9 (2020-12-20) # ncmpcpp-0.9 (2020-12-20)
* Fix various Mopidy specific bugs. * Fix various Mopidy specific bugs.

View File

@@ -90,6 +90,9 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
if (lyrics.empty() || notLyrics(data)) if (lyrics.empty() || notLyrics(data))
{ {
//std::cerr << "Data: " << data << "\n";
//std::cerr << "Empty: " << lyrics.empty() << "\n";
//std::cerr << "Not Lyrics: " << notLyrics(data) << "\n";
result.second = msgNotFound; result.second = msgNotFound;
return result; return result;
} }
@@ -183,7 +186,7 @@ LyricsFetcher::Result GoogleLyricsFetcher::fetch(const std::string &artist,
} }
data = unescapeHtmlUtf8(urls[0]); data = unescapeHtmlUtf8(urls[0]);
URL = data.c_str(); URL = data.c_str();
return LyricsFetcher::fetch("", ""); return LyricsFetcher::fetch("", "");
} }

View File

@@ -118,7 +118,7 @@ struct GeniusFetcher : public GoogleLyricsFetcher
virtual const char *name() const override { return "genius.com"; } virtual const char *name() const override { return "genius.com"; }
protected: protected:
virtual const char *regex() const override { return "<div class=\"Lyrics__Container.*?\">(.*?)</div>"; } virtual const char *regex() const override { return "<div class=\"[Ll]yrics.*?>(.*?)</div>"; }
}; };
struct JahLyricsFetcher : public GoogleLyricsFetcher struct JahLyricsFetcher : public GoogleLyricsFetcher