pub struct WebsiteMetaService { /* private fields */ }Expand description
Service for looking up website metadata and storing a cached value
Implementations§
Source§impl WebsiteMetaService
impl WebsiteMetaService
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new instance of the service, this initializes the HTTP client and creates the cache
Sourcepub fn from_client(client: Client) -> Self
👎Deprecated
pub fn from_client(client: Client) -> Self
Create a web scraper from the provided client
Using a custom client can cause security measures to not be fully applied leading to gaps in security its recommended you use WebsiteMetaService::from_config unless you have a specific use case which is prevented by it
Sourcepub fn from_config(config: WebsiteMetaServiceConfig) -> Result<Self>
pub fn from_config(config: WebsiteMetaServiceConfig) -> Result<Self>
Create a web scraper from the provided config
Sourcepub async fn resolve_website(
&self,
url: &Url,
) -> Option<ResolvedWebsiteMetadata>
pub async fn resolve_website( &self, url: &Url, ) -> Option<ResolvedWebsiteMetadata>
Resolves the metadata for the website at the provided URL
Sourcepub async fn resolve_website_favicon(&self, url: &Url) -> Option<ResolvedImage>
pub async fn resolve_website_favicon(&self, url: &Url) -> Option<ResolvedImage>
Resolve the favicon image at the provided URL
Sourcepub async fn resolve_website_image(&self, url: &Url) -> Option<ResolvedImage>
pub async fn resolve_website_image(&self, url: &Url) -> Option<ResolvedImage>
Resolve the OGP metadata image from the provided URL
Sourcepub async fn resolve_favicon(
&self,
url: &Url,
best_favicon: Option<String>,
) -> Option<ResolvedImage>
pub async fn resolve_favicon( &self, url: &Url, best_favicon: Option<String>, ) -> Option<ResolvedImage>
Resolve the favicon using the best favicon. Used by wrapping services to provide
the default favicon fallback URL for favicons and resolve favicon images without
internally calling Self::resolve_website
Sourcepub async fn resolve_image(
&self,
url: &Url,
image: &str,
) -> Option<ResolvedImage>
pub async fn resolve_image( &self, url: &Url, image: &str, ) -> Option<ResolvedImage>
Resolve an image content type and provide a stream to download the image