ISODate -> ISOWeek; exists(dirname + "/lock")
This commit is contained in:
@@ -30,6 +30,11 @@ var (
|
||||
agent = "AhrefsBot/7.0"
|
||||
)
|
||||
|
||||
func exists(filename string) bool {
|
||||
_, err := os.Stat(filename)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
req, err := http.NewRequest("GET", "https://rss.at5.nl/rss", nil)
|
||||
x(err)
|
||||
@@ -57,6 +62,9 @@ func main() {
|
||||
x(err)
|
||||
year, week := t.ISOWeek()
|
||||
dirname := fmt.Sprintf("/net/corpora/nlnieuws/AT5/%d/%02d", year, week)
|
||||
if exists(dirname + "/lock") {
|
||||
continue
|
||||
}
|
||||
basename := strings.TrimPrefix(item.Guid, "https://www.at5.nl/artikelen/")
|
||||
if i := strings.LastIndex(basename, "/"); i > 0 {
|
||||
basename = basename[:i]
|
||||
|
||||
Reference in New Issue
Block a user