diff --git a/NEWS b/NEWS
index 5eb948c2..870d20e8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
ncmpcpp-0.6.7 (????-??-??)
+* Fetching artist info from last.fm was fixed.
ncmpcpp-0.6.6 (2015-09-07)
* A typo in the example configuration file was fixed.
diff --git a/src/lastfm_service.cpp b/src/lastfm_service.cpp
index 9eec5e50..ec7f6e63 100644
--- a/src/lastfm_service.cpp
+++ b/src/lastfm_service.cpp
@@ -116,9 +116,11 @@ Service::Result ArtistInfo::processData(const std::string &data)
rx.assign("(.*?)");
+ rx.assign("
(.*?)
");
if (boost::regex_search(wiki, what, rx))
desc = unescapeHtmlUtf8(what[1]);
}
diff --git a/src/utility/html.cpp b/src/utility/html.cpp
index 80f62c33..d48ce4b4 100644
--- a/src/utility/html.cpp
+++ b/src/utility/html.cpp
@@ -20,7 +20,6 @@
#include
#include "utility/html.h"
-//#include "utility/string.h"
std::string unescapeHtmlUtf8(const std::string &data)
{
@@ -51,18 +50,28 @@ std::string unescapeHtmlUtf8(const std::string &data)
return result;
}
+void unescapeHtmlEntities(std::string &s)
+{
+ // well, at least some of them.
+ boost::replace_all(s, "&", "&");
+ boost::replace_all(s, ">", ">");
+ boost::replace_all(s, "<", "<");
+ boost::replace_all(s, " ", " ");
+ boost::replace_all(s, """, "\"");
+}
+
void stripHtmlTags(std::string &s)
{
bool erase = 0;
for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<"))
{
size_t j = s.find(">", i)+1;
- s.replace(i, j-i, "");
+ if (s.compare(i, j-i, "") == 0 || s.compare(i, j-i, "
") == 0)
+ s.replace(i, j-i, "\n");
+ else
+ s.replace(i, j-i, "");
}
- boost::replace_all(s, "'", "'");
- boost::replace_all(s, "&", "&");
- boost::replace_all(s, """, "\"");
- boost::replace_all(s, " ", " ");
+ unescapeHtmlEntities(s);
for (size_t i = 0; i < s.length(); ++i)
{
if (erase)
diff --git a/src/utility/html.h b/src/utility/html.h
index cde06ba1..9a98a4a2 100644
--- a/src/utility/html.h
+++ b/src/utility/html.h
@@ -24,7 +24,7 @@
#include
std::string unescapeHtmlUtf8(const std::string &s);
-
+void unescapeHtmlEntities(std::string &s);
void stripHtmlTags(std::string &s);
#endif // NCMPCPP_UTILITY_HTML_H