Lyrics fetcher: fix metrolyrics.com fetchers

This commit is contained in:
Andrzej Rybczak
2018-03-18 11:07:28 +01:00
parent 1b98dd71e1
commit 557720061d
3 changed files with 8 additions and 3 deletions

2
NEWS
View File

@@ -1,7 +1,7 @@
ncmpcpp-0.8.2 (????-??-??)
* Help screen: fixed display of EoF keycode
* Fixed possible integer overflow when resizing screen
* Fixed fetching lyrics from lyricsmania.com and sing365.com
* Fixed fetching lyrics from lyricsmania.com, metrolyrics.com and sing365.com
ncmpcpp-0.8.1 (2017-10-11)
* Setting 'colors_enabled' to 'no' no longer results in a crash.

View File

@@ -119,7 +119,12 @@ std::vector<std::string> LyricsFetcher::getContent(const char *regex_,
auto first = boost::sregex_iterator(data.begin(), data.end(), rx);
auto last = boost::sregex_iterator();
for (; first != last; ++first)
result.push_back(first->str(1));
{
std::string content;
for (size_t i = 1; i < first->size(); ++i)
content += first->str(i);
result.push_back(std::move(content));
}
return result;
}

View File

@@ -88,7 +88,7 @@ struct MetrolyricsFetcher : public GoogleLyricsFetcher
virtual const char *name() const override { return "metrolyrics.com"; }
protected:
virtual const char *regex() const override { return "<div class=\"lyrics-body\">(.*?)</div>"; }
virtual const char *regex() const override { return "<div class=\"lyrics-body\">(.*?)<!--WIDGET.*?<!-- Second Section -->(.*?)<!--WIDGET.*?<!-- Third Section -->(.*?)</div>"; }
virtual bool isURLOk(const std::string &url) override;
};