lyrics fetcher: remove ad from lyricsvip lyrics

This commit is contained in:
Andrzej Rybczak
2012-07-13 21:00:32 +02:00
parent 281263b957
commit 5e83aade22
2 changed files with 15 additions and 0 deletions

View File

@@ -261,6 +261,19 @@ void SonglyricsFetcher::postProcess(std::string &data)
LyricsFetcher::postProcess(data);
}
/**********************************************************************/
void LyricsvipFetcher::postProcess(std::string &data)
{
// throw away <div> with ad
size_t i = data.find("<div class=\"ad\""), j = data.find("</div>");
if (i != std::string::npos && i != std::string::npos)
data.replace(i, j-i+static_strlen("</div>"), "");
data = unescapeHtmlUtf8(data);
LyricsFetcher::postProcess(data);
}
/**********************************************************************/
LyricsFetcher::Result InternetLyricsFetcher::fetch(const std::string &artist, const std::string &title)

View File

@@ -168,6 +168,8 @@ struct LyricsvipFetcher : public GoogleLyricsFetcher
virtual const char *getSiteKeyword() { return "lyricsvip"; }
virtual const char *getOpenTag() { return "</h2>"; }
virtual const char *getCloseTag() { return "</td>"; }
virtual void postProcess(std::string &data);
};
struct JustSomeLyricsFetcher : public GoogleLyricsFetcher