Skip to main content

Sitemap Utility Suite

A Python-based utility suite designed to fetch and analyze sitemaps and other well-known files from websites.

Table of Contents

Features

  • Fetch and parse XML sitemaps from websites
  • Recursively traverse sitemap indices
  • Extract sitemap URLs from robots.txt files
  • Fetch common well-known files (robots.txt, humans.txt, security.txt)
  • Robust error handling and logging
  • User-agent spoofing for web requests

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/sitemap-utility-suite.git
    cd sitemap-utility-suite
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    

Installation with documentation dependencies

To install Sitemap Grabber with documentation dependencies:

  1. Ensure you have flit installed:

    pip install flit
    
  2. Install the package with documentation dependencies:

    flit install --deps develop --extras docs
    

For developers who want to contribute to the project:

  1. Install the package with both documentation and development dependencies:
    flit install --deps develop --extras "docs,dev"
    

Alternatively, if you prefer using pip:

pip install -e ".[docs,dev]"

This will install the package in editable mode along with all necessary dependencies for building the documentation and development tools.


Usage

Here's a basic example of how to use the SitemapGrabber:

from sitemap_grabber import SitemapGrabber

# Initialize the SitemapGrabber with a website URL
grabber = SitemapGrabber("https://example.com")

# Fetch all sitemaps
grabber.get_all_sitemaps()

# Print the discovered sitemap URLs
for url in grabber.sitemap_urls:
    print(url)

To fetch well-known files:

from well_known_files import WellKnownFiles

# Initialize the WellKnownFiles with a website URL
wkf = WellKnownFiles("https://example.com")

# Fetch robots.txt
robots_txt = wkf.fetch("robots.txt")
print(robots_txt)

# Fetch security.txt
security_txt = wkf.fetch("security.txt")
print(security_txt)

Components

SitemapGrabber

The SitemapGrabber class is responsible for discovering and fetching XML sitemaps from a given website. It can:

  • Extract sitemap URLs from robots.txt
  • Check common sitemap locations
  • Recursively traverse sitemap indices
  • Handle relative and absolute URLs

WellKnownFiles

The WellKnownFiles class fetches common well-known files from websites, including:

  • robots.txt
  • humans.txt
  • security.txt

It includes caching to avoid redundant requests and can handle various edge cases in HTTP responses.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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


For more information or to report issues, please visit the GitHub repository.

Metadata

Release files for sitemap_grabber 2.0.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 sitemap_grabber 2.0.1
File Size Uploaded
sitemap_grabber-2.0.1.tar.gz 13.3 kB Details

Built distribution (wheel)

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

Total release size: 20.1 kB

Release files / sitemap_grabber-2.0.1.tar.gz

Download URL sitemap_grabber-2.0.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
04ce3abc35d8385765e67a6cd5f82adf632d1107d0c33302a9abff617eb12c84
BLAKE2b-256 checksum
How to use checksums
4f5466efedf0420998f8a85eeeb9b0dac8a3f8e59d2e50f4e7ec617abad5cb7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / sitemap_grabber-2.0.1-py3-none-any.whl

Download URL sitemap_grabber-2.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35130e08eab1558255d25fbbe2a0cb97f3482d78813d453d075703b0806a4f25
BLAKE2b-256 checksum
How to use checksums
15f3343498c3fa7c42f1f1ff09ef1843b9d2b3418aa895d97f6d23866ac5727b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.1

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