Compare commits
No commits in common. "541d70711cb5d99e85972e26aeae9e2fd62f4d02" and "f20e4104227f451bb01a90b5acd86c1a7469ee22" have entirely different histories.
541d70711c
...
f20e410422
2 changed files with 0 additions and 16 deletions
|
@ -11,9 +11,6 @@ const ICON_SELECTOR: &str =
|
||||||
"link[rel~='icon'], link[rel~='apple-touch-icon'], link[rel~='apple-touch-icon-precomposed']";
|
"link[rel~='icon'], link[rel~='apple-touch-icon'], link[rel~='apple-touch-icon-precomposed']";
|
||||||
const MANIFEST_SELECTOR: &str = "link[rel~='manifest']";
|
const MANIFEST_SELECTOR: &str = "link[rel~='manifest']";
|
||||||
|
|
||||||
/// Represents useful data scraped from HTML.
|
|
||||||
///
|
|
||||||
/// To obtain, use [`HTML::scan_html`].
|
|
||||||
pub struct HTML {
|
pub struct HTML {
|
||||||
pub icons: Vec<Icon>,
|
pub icons: Vec<Icon>,
|
||||||
pub manifest: Option<Url>,
|
pub manifest: Option<Url>,
|
||||||
|
|
13
src/icon.rs
13
src/icon.rs
|
@ -5,30 +5,17 @@ use url::Url;
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
/// The source of a scraped icon.
|
|
||||||
///
|
|
||||||
/// More sources may be added in the future.
|
|
||||||
#[non_exhaustive]
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum IconKind {
|
pub enum IconKind {
|
||||||
/// Discovered through checking a hardcoded URL path, like `/favicon.ico`
|
|
||||||
HardcodedURL,
|
HardcodedURL,
|
||||||
/// Discovered through parsing the HTML for `<link rel="icon">`s (or similar)
|
|
||||||
LinkedInHTML,
|
LinkedInHTML,
|
||||||
/// Discovered through parsing the Web App Manifest linked in the HTML in `<link rel="manifest">`
|
|
||||||
LinkedInManifest,
|
LinkedInManifest,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A scraped icon.
|
|
||||||
///
|
|
||||||
/// To obtain, use [`crate::scrape`], [`crate::html::HTML::scan_html`], or [`crate::manifest::scan_manifest`].
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Icon {
|
pub struct Icon {
|
||||||
/// Describes how the icon was discovered
|
|
||||||
pub kind: IconKind,
|
pub kind: IconKind,
|
||||||
/// The source URL of the scraped icon, with redirects resolved
|
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
/// The size of the scraped icon, in pixels
|
|
||||||
pub size: ImageSize,
|
pub size: ImageSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue