Skip to content

Instantly share code, notes, and snippets.

@guitarrapc guitarrapc/main.go
Created Jan 5, 2019

Embed
What would you like to do?
retrieve sitemap
package main
import (
"fmt"
"os"
sitemap "github.com/yterajima/go-sitemap"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %s URL\n", os.Args[0])
os.Exit(1)
}
sitemapURL := os.Args[1] + "/sitemap.xml"
xml, err := sitemap.Get(sitemapURL, nil)
if err != nil {
fmt.Println(err)
return
}
for _, loc := range xml.URL {
fmt.Println(loc.Loc)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.