class

Vug::HtmlExtractor

Inherits Reference < Object

Constants

FAVICON_SELECTORS = ["link[rel~='icon']", "link[rel='shortcut icon']", "link[rel='apple-touch-icon']", "link[rel='apple-touch-icon-precomposed']", "link[type='image/x-icon']"]

Constructors

new(config : Config = Config.default, deps : Dependencies = Dependencies.new)
Source

Class methods

data_url_identifier(data : Bytes) : String

Generate a stable synthetic URL identifier for a data-URL resource. Uses SHA256 of the content bytes, prefixed with "data:" to distinguish from real URLs. Suitable as a cache key.

Source

Instance methods

extract(site_url : String) : String | Nil

Backward compatibility method - returns first favicon only

Source
extract_all(site_url : String, timeout : Time::Span | Nil = nil) : Array(FaviconInfo)

Extract favicon information from a site's HTML. Optionally accepts a custom timeout for slow servers.

Source

Nested types