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<WebsiteMetaService, Error>
pub fn new() -> Result<WebsiteMetaService, Error>
Creates a new instance of the service, this initializes the HTTP client and creates the cache
Sourcepub fn from_client(client: Client) -> WebsiteMetaService
👎Deprecated
pub fn from_client(client: Client) -> WebsiteMetaService
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<WebsiteMetaService, Error>
pub fn from_config( config: WebsiteMetaServiceConfig, ) -> Result<WebsiteMetaService, Error>
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
Auto Trait Implementations§
impl !RefUnwindSafe for WebsiteMetaService
impl !UnwindSafe for WebsiteMetaService
impl Freeze for WebsiteMetaService
impl Send for WebsiteMetaService
impl Sync for WebsiteMetaService
impl Unpin for WebsiteMetaService
impl UnsafeUnpin for WebsiteMetaService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more