From ed5917b93523bd6535f0e82809d209c7768b2cce Mon Sep 17 00:00:00 2001 From: Evgeny Kuznetsov Date: Sun, 16 Jun 2019 22:05:51 +0300 Subject: initial commit It works! Can already be used! --- main.go | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 main.go (limited to 'main.go') diff --git a/main.go b/main.go new file mode 100644 index 0000000..75dad75 --- /dev/null +++ b/main.go @@ -0,0 +1,100 @@ +package main + +import ( + "flag" + "github.com/gorilla/feeds" + "io/ioutil" + "log" + "net/http" + "regexp" + "strconv" + "time" +) + +type subst struct { + from string + to string +} + +var ( + substitutes = []subst{ + {from: `"`, to: `"`}, + {from: `–`, to: `–`}, + } + + programNameRe = regexp.MustCompile(`

(.+?)?

`) + episodeRe = regexp.MustCompile(`(?s)
(.+?)?
`) + episodeAudioRe = regexp.MustCompile(`data\-id="(.+?)?">`) + episodeDateRe = regexp.MustCompile(`brand\-time brand\-menu\-link">(.+?)?\.(.+?)?\.(.+?)? в (.+?)?:(.+?)?`) + episodeTitleRe = regexp.MustCompile(`title brand\-menu\-link">(.+?)?`) + episodeUrlRe = regexp.MustCompile(`