Fix fetching lyrics from sing365.com and genius.com

master
Andrzej Rybczak 9 years ago
parent 2362770b66
commit 99107c5b39
  1. 4
      src/lyrics_fetcher.cpp
  2. 4
      src/lyrics_fetcher.h

@ -78,7 +78,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
boost::replace_all(url, "%title%", Curl::escape(title)); boost::replace_all(url, "%title%", Curl::escape(title));
std::string data; std::string data;
CURLcode code = Curl::perform(data, url); CURLcode code = Curl::perform(data, url, "", true);
if (code != CURLE_OK) if (code != CURLE_OK)
{ {
@ -87,7 +87,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
} }
auto lyrics = getContent(regex(), data); auto lyrics = getContent(regex(), data);
if (lyrics.empty() || notLyrics(data)) if (lyrics.empty() || notLyrics(data))
{ {
result.second = msgNotFound; result.second = msgNotFound;

@ -106,7 +106,7 @@ struct Sing365Fetcher : public GoogleLyricsFetcher
virtual const char *name() const override { return "sing365.com"; } virtual const char *name() const override { return "sing365.com"; }
protected: protected:
virtual const char *regex() const override { return "<!-Lyrics Begin->(.*?)<!-Lyrics End->"; } virtual const char *regex() const override { return "<div class=\"content\">.*?</script>(.*?)<script>"; }
}; };
struct JustSomeLyricsFetcher : public GoogleLyricsFetcher struct JustSomeLyricsFetcher : public GoogleLyricsFetcher
@ -130,7 +130,7 @@ struct GeniusFetcher : public GoogleLyricsFetcher
virtual const char *name() const override { return "genius.com"; } virtual const char *name() const override { return "genius.com"; }
protected: protected:
virtual const char *regex() const override { return "<lyrics.*?>(.*?)</lyrics>"; } virtual const char *regex() const override { return "<div class=\"lyrics\">(.*?)</div>"; }
}; };
struct JahLyricsFetcher : public GoogleLyricsFetcher struct JahLyricsFetcher : public GoogleLyricsFetcher

Loading…
Cancel
Save