From 8358fb2e565a8f9949763df946d107cc2d92f9d8 Mon Sep 17 00:00:00 2001 From: Evgeny Kuznetsov Date: Tue, 28 Jan 2020 08:04:19 +0300 Subject: add feed desc to test --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 5a2bd3e..6769385 100644 --- a/main.go +++ b/main.go @@ -154,10 +154,14 @@ func populateFeed(feed *feeds.Feed, page []byte) { func describeFeed(feed *feeds.Feed, wg *sync.WaitGroup) { defer wg.Done() programAboutUrl := strings.TrimSuffix(feed.Link.Href, "episodes") + "about" - programAboutPage := getPage(programAboutUrl) - programAbout := programAboutRe.FindSubmatch(programAboutPage)[1] + page := getPage(programAboutUrl) + feed.Description = processFeedDesc(page) +} + +func processFeedDesc(page []byte) string { + programAbout := programAboutRe.FindSubmatch(page)[1] re := regexp.MustCompile(`<(.+?)?>`) - feed.Description = string(re.ReplaceAll(programAbout, []byte(``))) + return string(re.ReplaceAll(programAbout, []byte(``))) } func describeEpisodes(feed *feeds.Feed) { -- cgit v1.2.3