From e322ed87de2d1a91e464552967d308324b32170a Mon Sep 17 00:00:00 2001 From: Evgeny Kuznetsov Date: Mon, 17 Jun 2019 07:32:52 +0300 Subject: add feed image --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index fb23dc4..caa9748 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ var ( programNameRe = regexp.MustCompile(`

(.+?)?

`) programAboutRe = regexp.MustCompile(`(?s)
(.+?)?
`) + programImageRe = regexp.MustCompile(`(?s)
(.+?)?`) episodeRe = regexp.MustCompile(`(?s)
(.+?)?
`) episodeAudioRe = regexp.MustCompile(`data\-id="(.+?)?">`) episodeDateRe = regexp.MustCompile(`brand\-time brand\-menu\-link">(.+?)?\.(.+?)?\.(.+?)? в (.+?)?:(.+?)?`) @@ -49,6 +50,13 @@ func main() { feed.Title = string(programNameRe.FindSubmatch(programPage)[1]) feed.Link = &feeds.Link{Href: programUrl} + programImage := programImageRe.FindSubmatch(programPage) + feed.Image = &feeds.Image{ + Link: programUrl, + Url: string(programImage[2]), + Title: string(programImage[4]), + } + episodes := episodeRe.FindAll(programPage, -1) programAboutUrl := "http://www.radiorus.ru/brand/" + programNumber + "/about" -- cgit v1.2.3