aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorEvgeny Kuznetsov <evgeny@kuznetsov.md>2020-01-28 08:04:19 +0300
committerEvgeny Kuznetsov <evgeny@kuznetsov.md>2020-01-28 08:04:19 +0300
commit8358fb2e565a8f9949763df946d107cc2d92f9d8 (patch)
tree1415c5f583022d935392499ef226c8a956406561 /main.go
parent30a4cbfd963450637cd80f08b8c6b0a7c7ece92c (diff)
downloadradiorus-rss-8358fb2e565a8f9949763df946d107cc2d92f9d8.tar.gz
radiorus-rss-8358fb2e565a8f9949763df946d107cc2d92f9d8.zip
add feed desc to test
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 7 insertions, 3 deletions
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) {