lyrics fetcher: fix fetchers and improve formatting of lyrics

This commit is contained in:
Andrzej Rybczak
2016-10-30 23:25:51 +01:00
parent a53c574edd
commit 888b6bc1c9
4 changed files with 26 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ void stripHtmlTags(std::string &s)
for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<"))
{
size_t j = s.find(">", i)+1;
if (s.compare(i, j-i, "<p>") == 0 || s.compare(i, j-i, "</p>") == 0)
if (s.compare(i, std::min(3ul, j-i), "<p ") == 0 || s.compare(i, j-i, "</p>") == 0)
s.replace(i, j-i, "\n");
else
s.replace(i, j-i, "");
@@ -87,4 +87,4 @@ void stripHtmlTags(std::string &s)
else if (s[i] == '\t')
s[i] = ' ';
}
}
}