fix: add image link to the discovery queue - #87
Open
SuoweiHu wants to merge 2 commits into
Open
Conversation
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.
Problem
Unless manually provided an image link to crawl in the first place, images almost never shown in the Images tab, despite the crawler extracting image metadata from HTML pages. For mainly two reasons:
extract_links()only queued<a href>URLs —<img src>URLs were collected for the Links tab (collect_all_links()) and for per-page metadata (extract_images()), but were never added to the crawl discovery queue. So image URLs were never actually fetched as standalone resources.include_extensionsexcluded image types (jpg, jpeg, png, gif, webp, svg, ico, avif, bmp) — Even if image URLs had reached the queue, the_should_crawl_url()extension filter only allowedhtml, htm, php, asp, aspx, jsp, rejecting all image file extensions.Changes
crawler.pyjpg, jpeg, png, gif, webp, svg, ico, avif, bmpto the defaultinclude_extensionslist in_get_default_config()settings_manager.pyincludeExtensionsstringsettings.jsdefaultSettings.includeExtensionsindex.html<input>default value for the Include File Extensions field to include image typeslink_manager.pyextract_linksthat iterates over<img src>tags after the existing<a href>loop. Each image URL is queued via the sameshould_crawl_callbackfilter to ensure they fulfil theincludeExtensionconstraint.Notes
Before/After Change Comparison (crawling the same URL):
