An efficient website icon scraper for rust or command line usage.
- Super fast!
- Partially downloads images to find the sizes
- Can extract a site logo
<img>
using a weighing system - Works with inline-data URIs (and automatically converts
<svg>
to them) - Supports WASM (and cloudflare workers)
cargo install site_icons
site-icons https://github.com
# https://github.githubassets.com/favicons/favicon.svg site_favicon svg
# https://github.githubassets.com/app-icon-512.png app_icon png 512x512
# https://github.githubassets.com/app-icon-192.png app_icon png 192x192
# https://github.githubassets.com/apple-touch-icon-180x180.png app_icon png 180x180
use site_icons::Icons;
let mut icons = Icons::new();
// scrape the icons from a url
icons.load_website("https://github.com").await?;
// 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)
}
- HTML favicon tag (or looking for default
/favicon.ico
) - Web app manifest
icons
field <img>
tags on the page, directly inside the header OR with asrc|alt|class
containing the text "logo"
Install cargo make and then:
cargo make run https://github.com