diff --git a/Cargo.lock b/Cargo.lock index 112d8c7..5acdf13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1786,7 +1786,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "site_icons" -version = "0.6.3" +version = "0.6.4" dependencies = [ "byteorder", "cached", diff --git a/Cargo.toml b/Cargo.toml index 1972648..9282eba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "site_icons" -version = "0.6.3" +version = "0.6.4" authors = ["Sam Denty "] edition = "2018" license = "GPL-3.0" diff --git a/src/icon/icon_info.rs b/src/icon/icon_info.rs index 071c886..50ab597 100644 --- a/src/icon/icon_info.rs +++ b/src/icon/icon_info.rs @@ -94,37 +94,6 @@ impl IconInfo { } _ => { - if let Some(sizes) = &sizes { - match &url.path().split('.').last().unwrap_or("").to_lowercase()[..] { - "svg" => { - return Ok(IconInfo::SVG { - size: Some(*sizes.largest()), - }); - } - "png" => { - return Ok(IconInfo::PNG { - size: *sizes.largest(), - }); - } - "jpeg" | "jpg" => { - return Ok(IconInfo::JPEG { - size: *sizes.largest(), - }); - } - "ico" => { - return Ok(IconInfo::ICO { - sizes: sizes.clone(), - }); - } - "gif" => { - return Ok(IconInfo::GIF { - size: *sizes.largest(), - }); - } - _ => {} - }; - } - let res = CLIENT .get(url) .headers(headers) diff --git a/src/lib.rs b/src/lib.rs index 4983e73..c8592ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,24 +44,3 @@ static CLIENT: Lazy = Lazy::new(|| { headers.insert(USER_AGENT, HeaderValue::from_str("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36").unwrap()); Client::builder().default_headers(headers).build().unwrap() }); - -// #[cfg(test)] -// mod tests { -// use super::*; -// #[tokio::test] -// async fn test_icons() { -// let mut icons = SiteIcons::new(); -// // scrape the icons from a url -// icons.load_website("https://github.com").await.unwrap(); - -// // fetch all icons, ensuring they exist & determining size -// let entries = icons.entries().await; - -// // entries are sorted from highest to lowest resolution -// for icon in &entries { -// println!("{:?}", icon) -// } - -// assert_eq!(entries.len() > 0, true); -// } -// }