diff options
author | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2020-01-28 08:04:19 +0300 |
---|---|---|
committer | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2020-01-28 08:04:19 +0300 |
commit | 8358fb2e565a8f9949763df946d107cc2d92f9d8 (patch) | |
tree | 1415c5f583022d935392499ef226c8a956406561 /main.go | |
parent | 30a4cbfd963450637cd80f08b8c6b0a7c7ece92c (diff) | |
download | radiorus-rss-8358fb2e565a8f9949763df946d107cc2d92f9d8.tar.gz radiorus-rss-8358fb2e565a8f9949763df946d107cc2d92f9d8.zip |
add feed desc to test
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) { |