diff options
author | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2019-06-17 07:32:52 +0300 |
---|---|---|
committer | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2019-06-17 07:32:52 +0300 |
commit | e322ed87de2d1a91e464552967d308324b32170a (patch) | |
tree | 1db5c3330c18541e48f1040a4a9aad484f038fb7 /main.go | |
parent | dbf10b303bffc98c2f6090a7460c5f1e62384c5d (diff) | |
download | radiorus-rss-e322ed87de2d1a91e464552967d308324b32170a.tar.gz radiorus-rss-e322ed87de2d1a91e464552967d308324b32170a.zip |
add feed image
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -24,6 +24,7 @@ var ( programNameRe = regexp.MustCompile(`<h2>(.+?)?</h2>`) programAboutRe = regexp.MustCompile(`(?s)<div class="brand__content_text__anons">(.+?)?</div>`) + programImageRe = regexp.MustCompile(`(?s)<div class="brand\-promo__header">(.+?)?<img src="(.+?)?"(.+?)?alt='(.+?)?'>`) episodeRe = regexp.MustCompile(`(?s)<div class="brand__list\-\-wrap\-\-item">(.+?)?<div class="add\-to\-list">`) episodeAudioRe = regexp.MustCompile(`data\-id="(.+?)?">`) episodeDateRe = regexp.MustCompile(`brand\-time brand\-menu\-link">(.+?)?\.(.+?)?\.(.+?)? в (.+?)?:(.+?)?</a>`) @@ -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" |