fix: filter sitemap-derived URLs by enqueue strategy#3797
Open
vdusek wants to merge 4 commits into
Open
Conversation
B4nan
reviewed
Jun 30, 2026
B4nan
reviewed
Jun 30, 2026
| export type SearchParams = string | URLSearchParams | Record<string, string | number | boolean | null | undefined>; | ||
|
|
||
| /** Enqueue strategy values, mirroring the `EnqueueStrategy` enum from `@crawlee/core` (which `@crawlee/utils` can't import). */ | ||
| export type EnqueueStrategyValue = 'all' | 'same-hostname' | 'same-domain' | 'same-origin'; |
Member
There was a problem hiding this comment.
same here
Suggested change
| export type EnqueueStrategyValue = 'all' | 'same-hostname' | 'same-domain' | 'same-origin'; | |
| export type EnqueueStrategyValue = `${EnqueueStrategy}`; |
i would rather inline this instead of introducing a new exported type for it
Contributor
Author
There was a problem hiding this comment.
This is not possible because crawlee/core already depends on crawlee/utils, so that would be a circular reference. Am I correct? 🙂
B4nan
reviewed
Jun 30, 2026
Contributor
Author
|
@B4nan FYI; this is still a draft - I haven't reviewed most of it yet |
Member
|
no worries, i was just curious 🙃 |
Contributor
Author
|
Requesting a review from @janbuchar, since you may have additional context from the Python solution. |
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.
SitemapRequestList,Sitemap.load/parseSitemap, andRobotsTxtFile.getSitemaps()now apply an enqueue strategy to the URLs they extract. They keep only entries that match the strategy (defaultsame-hostname) relative to their parent sitemap, and always drop non-http(s)schemes. This brings sitemap loading in line withenqueueLinks, which already scopes discovered links to the same hostname by default.The selected strategy is also stamped onto the emitted
Requestobjects, so it keeps being enforced after navigation (e.g. across redirects).This changes the default behavior: cross-host sitemap entries are no longer enqueued unless you opt in with
enqueueStrategy: 'all'(or'same-domain'/'same-origin').