Repository navigation
Conversation
All three deep-crawl strategies took the internal-link list straight out of `result.links` and then did `links += external`. That list is the caller's own `CrawlResult.links["internal"]`, so with `include_external=True` every external link of the page stayed appended to the result the user receives after the crawl, inflating `links["internal"]` with URLs from other domains.
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.
What
BFSDeepCrawlStrategy,DFSDeepCrawlStrategyandBestFirstCrawlingStrategyappended the external links of a page to the caller'sCrawlResult.links["internal"].Why
All three strategies start with
result.links["internal"]is the list object owned by theCrawlResultthat is handed back to the user after the crawl, and+=mutates it in place. Withinclude_external=Trueevery external URL of every crawled page therefore ended up inresult.links["internal"], so downstream filtering (links["external"], link counting, storage) saw a result that no longer matched the page.The fix copies the list before extending it, in all three strategies.
How checked
Added
tests/test_deep_crawl_include_external_links.py, which callslink_discovery()on a synthetic result with one internal and one external link and asserts that the external link is returned for crawling butresult.links["internal"]is left as it was.main: 3 failed (links['internal'] == ['https://example.com/a', 'https://other.com/b'])