pub struct MetaScraper { /* private fields */ }Implementations§
Source§impl MetaScraper
impl MetaScraper
pub fn new(html: &str) -> Self
Sourcepub fn extract_title(&self) -> Option<String>
pub fn extract_title(&self) -> Option<String>
Expected Output: "Page Title"
<title>Page Title</title>Sourcepub fn extract_og_title(&self) -> Option<String>
pub fn extract_og_title(&self) -> Option<String>
Expected Output: "Page Title"
<meta property="og:title" content="Page Title" />Sourcepub fn extract_twitter_title(&self) -> Option<String>
pub fn extract_twitter_title(&self) -> Option<String>
Expected Output: "Page Title"
<meta name="twitter:title" content="Page Title" />Sourcepub fn title(&self) -> Option<String>
pub fn title(&self) -> Option<String>
Retrieves the page title.
Priority order:
<meta property="og:title"><meta name="twitter:title"><title>
Returns the first one found.
Sourcepub fn extract_description(&self) -> Option<String>
pub fn extract_description(&self) -> Option<String>
Expected Output: "My Description"
<meta name="description" content="My Description" />Sourcepub fn extract_og_description(&self) -> Option<String>
pub fn extract_og_description(&self) -> Option<String>
Expected Output: "My Description"
<meta property="og:description" content="My Description" />Sourcepub fn extract_twitter_description(&self) -> Option<String>
pub fn extract_twitter_description(&self) -> Option<String>
Expected Output: "My Description"
<meta name="twitter:description" content="My Description" />Sourcepub fn description(&self) -> Option<String>
pub fn description(&self) -> Option<String>
Retrieves the page description.
Priority order:
<meta property="og:description"><meta name="twitter:description"><meta name="description">
Returns the first one found.
Sourcepub fn favicon(&self) -> Option<String>
pub fn favicon(&self) -> Option<String>
Expected Output: "/favicon.ico"
<link rel="icon" href="/favicon.ico" />Sourcepub fn extract_og_image(&self) -> Option<String>
pub fn extract_og_image(&self) -> Option<String>
Expected Output: "https://example.com/image.jpg"
<meta property="og:image" content="https://example.com/image.jpg" />Sourcepub fn extract_og_images(&self) -> Vec<String>
pub fn extract_og_images(&self) -> Vec<String>
Expected Output: ["https://example.com/image.jpg", "https://example.com/image.png"]
<meta property="og:image" content="https://example.com/image.jpg" />
<meta property="og:image" content="https://example.com/image.png" />Sourcepub fn extract_twitter_image(&self) -> Option<String>
pub fn extract_twitter_image(&self) -> Option<String>
Expected Output: "https://example.com/image.jpg"
<meta name="twitter:image" content="https://example.com/image.jpg" />
<meta name="twitter:image:alt" content="Image description" />Auto Trait Implementations§
impl Freeze for MetaScraper
impl !RefUnwindSafe for MetaScraper
impl !Send for MetaScraper
impl !Sync for MetaScraper
impl Unpin for MetaScraper
impl UnwindSafe for MetaScraper
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
Mutably borrows from an owned value. Read more