Lyrics fetcher: fix metrolyrics.com fetchers
This commit is contained in:
2
NEWS
2
NEWS
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user