Skip to content

About

Fetch sitemap from URL, parse and convert as CSV, written by Go

Resources

Stars

1 star

Watchers

2 watching

Forks

Repository files navigation

go-sitemap2csv

A simple CLI tool to fetch, parse, and convert website sitemaps to CSV.

Test

Concept

Simple. No setup. No dependencies.

How to use

Install

Download a binary and put it to PATH.

For example, on Linux.

sudo curl -L -o /usr/local/bin/sitemap2csv $(curl --silent "https://api.github.com/repos/etsxxx/go-sitemap2csv/releases/latest" | jq --arg PLATFORM_ARCH "$(echo `uname -s`-`uname -m` | tr A-Z a-z)" -r '.assets[] | select(.name | endswith($PLATFORM_ARCH)) | .browser_download_url')
sudo chmod 755 /usr/local/bin/sitemap2csv

A full list of binaries are here.

Run

sitemap2csv <sitemap_url> <output_csv_file>

You get a CSV file like the following. The first record is a header row with "loc" and "lastmod". "lastmod" is empty if there is no lastmod value.

loc,lastmod
https://example.com/foo,
https://example.com/bar,2025-05-22T01:02:03.000Z
https://example.com/baz,

If you don't need header row, add '-no-header' option.

sitemap2csv -no-header <sitemap_url> <output_csv_file>

With '-no-header' option, you get a CSV file like the following.

https://example.com/foo,
https://example.com/bar,2025-05-22T01:02:03.000Z
https://example.com/baz,

Hack and Develop

Build

First, fork this repo, and get your clone locally.

  1. Install go
  2. Install make
  3. Install golangci-lint

Write code and remove unused modules.

make tidy

To test, run

make lint
make test

To build, run

make build

AUTHORS

About

Fetch sitemap from URL, parse and convert as CSV, written by Go

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages