From 5e83aade223caadbdccb305e9f6b98bdc0b51d16 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 13 Jul 2012 21:00:32 +0200 Subject: [PATCH] lyrics fetcher: remove ad from lyricsvip lyrics --- src/lyrics_fetcher.cpp | 13 +++++++++++++ src/lyrics_fetcher.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/lyrics_fetcher.cpp b/src/lyrics_fetcher.cpp index 09a3f7d4..8c85dd9c 100644 --- a/src/lyrics_fetcher.cpp +++ b/src/lyrics_fetcher.cpp @@ -261,6 +261,19 @@ void SonglyricsFetcher::postProcess(std::string &data) LyricsFetcher::postProcess(data); } + +/**********************************************************************/ + +void LyricsvipFetcher::postProcess(std::string &data) +{ + // throw away
with ad + size_t i = data.find("
"); + if (i != std::string::npos && i != std::string::npos) + data.replace(i, j-i+static_strlen("
"), ""); + data = unescapeHtmlUtf8(data); + LyricsFetcher::postProcess(data); +} + /**********************************************************************/ LyricsFetcher::Result InternetLyricsFetcher::fetch(const std::string &artist, const std::string &title) diff --git a/src/lyrics_fetcher.h b/src/lyrics_fetcher.h index ad67653a..65817902 100644 --- a/src/lyrics_fetcher.h +++ b/src/lyrics_fetcher.h @@ -168,6 +168,8 @@ struct LyricsvipFetcher : public GoogleLyricsFetcher virtual const char *getSiteKeyword() { return "lyricsvip"; } virtual const char *getOpenTag() { return ""; } virtual const char *getCloseTag() { return ""; } + + virtual void postProcess(std::string &data); }; struct JustSomeLyricsFetcher : public GoogleLyricsFetcher