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://reportersonline.nl/feed/", nil)
|
||||
x(err)
|
||||
@@ -57,6 +62,9 @@ func main() {
|
||||
x(err)
|
||||
year, week := t.ISOWeek()
|
||||
dirname := fmt.Sprintf("/net/corpora/nlnieuws/RO/%d/%02d", year, week)
|
||||
if exists(dirname + "/lock") {
|
||||
continue
|
||||
}
|
||||
basename := strings.TrimPrefix(item.Guid, "https://reportersonline.nl/?p=")
|
||||
if i := strings.LastIndex(basename, "/"); i > 0 {
|
||||
basename = basename[:i]
|
||||
|
||||
Reference in New Issue
Block a user