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://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]
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user