diff options
author | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2019-06-30 15:28:44 +0300 |
---|---|---|
committer | Evgeny Kuznetsov <evgeny@kuznetsov.md> | 2019-06-30 15:28:44 +0300 |
commit | 43b86af0949a7a9210741b9fae0f414c39ee72e8 (patch) | |
tree | e21ed76614c12b415945187a7b843f053187748f /main.go | |
parent | 8b17704db305ded6c0286444a34d67e4b9c6261c (diff) | |
download | radiorus-rss-43b86af0949a7a9210741b9fae0f414c39ee72e8.tar.gz radiorus-rss-43b86af0949a7a9210741b9fae0f414c39ee72e8.zip |
fix loops so that waiting actually works
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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) |