Skip to main content

sitemap2atom

A simple tool to convert an XML sitemap into an Atom feed — especially useful for sites that don't have a CMS, or where the CMS doesn't produce a feed. Each URL in the sitemap is fetched and its OpenGraph and Twitter Card metadata (title, description, image, author, dates) is used to build a rich Atom entry.

Installation

Run without installing (uvx)

Once published to PyPI you can run it directly with uv:

uvx sitemap2atom https://example.com/sitemap.xml -o feed.atom

To run the latest code straight from GitHub (before a release, or to try main):

uvx --from git+https://github.com/darkflib/sitemap2atom sitemap2atom https://example.com/sitemap.xml

Install as a tool / library

uv tool install sitemap2atom      # installs the `sitemap2atom` command
# or
pip install sitemap2atom

Usage

sitemap2atom SITEMAP_URL [OPTIONS]

By default the feed is written to standard output; redirect it or use -o to save it to a file:

# Print to stdout
sitemap2atom https://example.com/sitemap.xml

# Write to a file, limiting to the first 20 URLs
sitemap2atom https://example.com/sitemap.xml -o feed.atom --limit 20

Options

  • -o, --output PATH — write the Atom feed to this file (default: stdout).
  • --limit N — maximum number of sitemap URLs to process (default: all).
  • --feed-title TEXT — title for the generated feed (default: Enriched URL Feed).
  • --timeout SECONDS — per-request timeout in seconds (default: 10).
  • -v, --verbose — enable info-level logging on stderr.
  • --version — show the version and exit.

As a library

from sitemap2atom import fetch_sitemap_urls, enrich_url_list_to_atom, feed_to_pretty_xml

urls = fetch_sitemap_urls("https://example.com/sitemap.xml")
feed = enrich_url_list_to_atom(urls[:10], feed_title="My Feed")
print(feed_to_pretty_xml(feed))

Example output

See this gist for a sample of the kind of enriched Atom feed produced: https://gist.github.com/Darkflib/989b8f3a5a1ea995e8e294669d5e282a

Limitations

This is a simple tool aimed at basic use cases. It does not support authentication, sitemap index files / pagination, or dynamic sitemaps, and may not handle every sitemap or page format. Treat the sitemap and the pages it references as untrusted input and run it against sources you trust.

Some sites sit behind bot-protection that serves a JavaScript "verify your device" challenge instead of the real content. sitemap2atom sends browser-like headers, which is enough for many of these, but sites that require JavaScript execution cannot be fetched by a simple HTTP client. In that case you'll see a clear error explaining that an HTML page was returned instead of a sitemap.

Development

This project uses uv.

git clone https://github.com/darkflib/sitemap2atom.git
cd sitemap2atom
uv sync
uv run pytest

See CONTRIBUTING.md for more, and CHANGELOG.md for release notes.

License

This project is licensed under the MIT License — see the LICENSE file for details.

PS. If you do anything interesting with this code, please let me know! I'd love to hear about it.

Metadata

Release files for sitemap2atom 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sitemap2atom 0.1.1
File Size Uploaded
sitemap2atom-0.1.1.tar.gz 52.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sitemap2atom 0.1.1
File Interpreter ABI Platform
sitemap2atom-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 62.9 kB

Release files / sitemap2atom-0.1.1.tar.gz

Download URL sitemap2atom-0.1.1.tar.gz
Size 52.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b4f36c72213b954d0c5822720d2c3658206c2f2a17822ba714fca2f4c2650230
BLAKE2b-256 checksum
How to use checksums
58461ffe5cbfac3500ce7c0a6ab0c4daee9b7218e037bb3773a85b1ac452fc73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.

Transparency log

Release files / sitemap2atom-0.1.1-py3-none-any.whl

Download URL sitemap2atom-0.1.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1123a45f6005ccc0cdcd64d4506d511f9faa51fc610fcf79341133bd9bc72fbf
BLAKE2b-256 checksum
How to use checksums
c733e112e23c3d88efb90abfa0044333bcc6c01184924b01311d099fc9a58782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page