summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Rybczak <andrzej@rybczak.net>2020-12-21 01:00:22 +0100
committerAndrzej Rybczak <andrzej@rybczak.net>2020-12-21 01:04:57 +0100
commit37af7d805209b5402495b104ad4ff50f132d6004 (patch)
treee694f8f40dc8ebcdbbe1d1a119ca75ae5c9524b9
parentba2a4533ab5988921857a1ecf15d9cd26cea0f4e (diff)
Fix intermittent failures of the Genius fetcher
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/lyrics_fetcher.cpp5
-rw-r--r--src/lyrics_fetcher.h2
3 files changed, 6 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c1e5273..ea0270fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
# ncmpcpp-0.10 (????-??-??)
* Add support for fetching lyrics from musixmatch.com.
+* Fix intermittent failures of the Genius fetcher.
# ncmpcpp-0.9 (2020-12-20)
* Fix various Mopidy specific bugs.
diff --git a/src/lyrics_fetcher.cpp b/src/lyrics_fetcher.cpp
index c56a8732..1cea52aa 100644
--- a/src/lyrics_fetcher.cpp
+++ b/src/lyrics_fetcher.cpp
@@ -90,6 +90,9 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
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;
return result;
}
@@ -183,7 +186,7 @@ LyricsFetcher::Result GoogleLyricsFetcher::fetch(const std::string &artist,
}
data = unescapeHtmlUtf8(urls[0]);
-
+
URL = data.c_str();
return LyricsFetcher::fetch("", "");
}
diff --git a/src/lyrics_fetcher.h b/src/lyrics_fetcher.h
index 046a92f7..dd08939d 100644
--- a/src/lyrics_fetcher.h
+++ b/src/lyrics_fetcher.h
@@ -118,7 +118,7 @@ struct GeniusFetcher : public GoogleLyricsFetcher
virtual const char *name() const override { return "genius.com"; }
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