feat: add discover_valid_sitemaps utility#1777
Merged
Pijukatel merged 6 commits intoapify:masterfrom Mar 6, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ports/introduces a Python discover_valid_sitemaps helper to discover sitemap URLs for a set of input URLs (robots.txt sitemaps, direct sitemap URLs, and common sitemap paths), aligning with issue #1740.
Changes:
- Add
discover_valid_sitemaps()(plus internal helpers/constants) to orchestrate sitemap discovery per-hostname and deduplicate results. - Extend common sitemap probing to include
/sitemap_index.xmland addis_status_code_successful()for status evaluation. - Add unit tests covering robots.txt discovery, common-path probing, input URL detection, deduplication, and multi-domain behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/crawlee/_utils/sitemap.py |
Implements sitemap discovery orchestration, common-path probing, and async generator merging. |
src/crawlee/_utils/web.py |
Adds a helper to classify 2xx/3xx responses as “successful”. |
tests/unit/_utils/test_sitemap.py |
Adds unit tests for the new sitemap discovery utility with mocked HTTP behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Pijukatel
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
discover_valid_sitemapsutility to search for sitemaps of websites for the provided URLs.Issues
Testing