diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp
index 632c167d4..2d760e931 100644
--- a/src/core/utilities.cpp
+++ b/src/core/utilities.cpp
@@ -652,7 +652,8 @@ QString DecodeHtmlEntities(const QString &text) {
.replace("<", "<")
.replace("<", "<")
.replace(">", ">")
- .replace(">", ">");
+ .replace(">", ">")
+ .replace("'", "'");
return copy;
diff --git a/src/lyrics/geniuslyricsprovider.cpp b/src/lyrics/geniuslyricsprovider.cpp
index 1c96371f0..c5ab0e9e8 100644
--- a/src/lyrics/geniuslyricsprovider.cpp
+++ b/src/lyrics/geniuslyricsprovider.cpp
@@ -231,7 +231,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
}
else {
// See if there is Json data containing "status" and "userMessage" then use that instead.
- QByteArray data(reply->readAll());
+ QByteArray data = reply->readAll();
QJsonParseError json_error;
QJsonDocument json_doc = QJsonDocument::fromJson(data, &json_error);
if (json_error.error == QJsonParseError::NoError && !json_doc.isEmpty() && json_doc.isObject()) {
@@ -255,7 +255,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
}
}
- QByteArray data(reply->readAll());
+ QByteArray data = reply->readAll();
QJsonParseError json_error;
QJsonDocument json_doc = QJsonDocument::fromJson(data, &json_error);
@@ -333,8 +333,6 @@ bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &alb
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, id]() { HandleSearchReply(reply, id); });
- //qLog(Debug) << "GeniusLyrics: Sending request for" << url;
-
return true;
}
@@ -504,9 +502,33 @@ void GeniusLyricsProvider::HandleLyricReply(QNetworkReply *reply, const int sear
if (begin_idx > 0) {
begin_idx += tag_begin.length();
qint64 end_idx = content.indexOf(tag_end, begin_idx);
- lyrics = content.mid(begin_idx, end_idx - begin_idx);
- lyrics = lyrics.remove(QRegularExpression("<[^>]*>"));
- lyrics = lyrics.trimmed();
+ if (end_idx > 0) {
+ QString text = content.mid(begin_idx, end_idx - begin_idx);
+ text = text.replace(QRegularExpression("
]+>"), "\n");
+ text = text.remove(QRegularExpression("<[^>]*>"));
+ text = text.trimmed();
+ if (text.length() < 6000) {
+ lyrics = text;
+ }
+ }
+ }
+ else {
+ QRegularExpressionMatch rematch = QRegularExpression("