ISODate -> ISOWeek; exists(dirname + "/lock")

This commit is contained in:
Peter Kleiweg
2026-03-02 15:42:01 +01:00
parent 36f051a8a9
commit a94b190108
23 changed files with 260 additions and 37 deletions

View File

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

View File

@@ -9,7 +9,7 @@ export TZ=Europe/Amsterdam
if [ "$1" = "" ]
then
ds=`ISODate -7`
ds=`ISOWeek -7`
else
case "$1" in
2[0-9][0-9][0-9]-[0-5][0-9])