Crate meta_fetcher

Source
Expand description

§Metadata Fetcher

Metadata Fetcher is a utility for grabbing website metadata; useful for tasks like generating link previews. Its built ontop of ureq.

§Behavior

Metadata Fetcher first looks for a site’s Open Graph Protocol (OGP) metadata and if not found looks for the standard HTML metadata. If not metadata is found, it returns None for the missing field. This module also respects a site’s robots.txt file.

§Usage

use meta_fetcher::fetch_metadata;

// Grab the metadata for some URL
let meta = fetch_metadata("http://example.com").unwrap();

assert_eq!(meta.title, Some("Example Domain".to_string()));

Structs§

Metadata
This struct represents the metadata of a webpage. It contains the title, description, and image of the webpage, if available. Populated first by the Open Graph Protocol (OGP) metadata and then by the standard HTML metadata. If no metadata is found, the field is None.

Functions§

fetch_metadata
Fetch the metadata from the given URL.