aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorEvgeny Kuznetsov <evgeny@kuznetsov.md>2019-06-30 15:28:44 +0300
committerEvgeny Kuznetsov <evgeny@kuznetsov.md>2019-06-30 15:28:44 +0300
commit43b86af0949a7a9210741b9fae0f414c39ee72e8 (patch)
treee21ed76614c12b415945187a7b843f053187748f /main.go
parent8b17704db305ded6c0286444a34d67e4b9c6261c (diff)
downloadradiorus-rss-43b86af0949a7a9210741b9fae0f414c39ee72e8.tar.gz
radiorus-rss-43b86af0949a7a9210741b9fae0f414c39ee72e8.zip
fix loops so that waiting actually works
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.go b/main.go
index 140e452..c0cc9a0 100644
--- a/main.go
+++ b/main.go
@@ -81,11 +81,12 @@ func main() {
re := regexp.MustCompile(`<(.+?)?>`)
feed.Description = string(re.ReplaceAll(programAbout, []byte(``)))
+ badFeed := false
+
for _, episode := range episodes {
if len(episodeUrlRe.FindAllSubmatch(episode, -1)) > 1 {
- log.Println("Page looks strange. Episode in progress? Will wait for 15 minutes and try again...")
- time.Sleep(15 * 60 * time.Second)
- continue
+ badFeed = true
+ break
}
episodeUrl := "http://www.radiorus.ru/brand/" + string(episodeUrlRe.FindSubmatch(episode)[1])
episodeTitle := string(episodeTitleRe.FindSubmatch(episode)[1])
@@ -118,6 +119,11 @@ func main() {
})
}
+ if badFeed {
+ log.Println("Page looks strange. Episode in progress? Will wait for 15 minutes and try again...")
+ time.Sleep(15 * 60 * time.Second)
+ continue
+ }
rss, err := feed.ToRss()
if err != nil {
log.Fatal(err)