summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-28 13:16:12 -0400
committerdemo <demo@antix1>2026-05-28 13:16:12 -0400
commit2a6cdae8b8ea070000e9870c1df872c2adbb48a3 (patch)
treec6c4063e8405714e66bdd1193fecc1d1a7197c7f
parent0a4d96a5e9c49241bac81b20f5ceb91a2f8d1537 (diff)
feat: save sitemap to a file
-rw-r--r--classic.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/classic.go b/classic.go
index e30f3b3..709271f 100644
--- a/classic.go
+++ b/classic.go
@@ -6,6 +6,7 @@ import (
"fmt"
"log"
"net/url"
+ "os"
"sync"
"golang.org/x/net/html"
@@ -80,7 +81,13 @@ loop:
log.Fatal(err)
}
- fmt.Println(sitemap)
+ xmlFilename := fmt.Sprintf("%s.xml", startURL.Host)
+
+ if err := os.WriteFile(xmlFilename, []byte(sitemap), 0666); err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Printf("Wrote sitemap to %s\n", xmlFilename)
}
func getBatch(u url.URL) []url.URL {