pub struct MediaExtractor { /* private fields */ }Expand description
Main media extractor with configurable options
Implementations§
Source§impl MediaExtractor
impl MediaExtractor
Sourcepub fn with_config(config: MediaConfig) -> Self
pub fn with_config(config: MediaConfig) -> Self
Create with specific configuration
Sourcepub fn with_base_url(self, url: &str) -> Self
pub fn with_base_url(self, url: &str) -> Self
Set base URL for resolving relative URLs
Sourcepub fn config(&self) -> &MediaConfig
pub fn config(&self) -> &MediaConfig
Get current configuration
Sourcepub fn extract_all(&self, html: &str) -> MediaResult<ExtractedMedia>
pub fn extract_all(&self, html: &str) -> MediaResult<ExtractedMedia>
Extract all media from HTML string
Sourcepub fn extract_from_document(
&self,
document: &Html,
) -> MediaResult<ExtractedMedia>
pub fn extract_from_document( &self, document: &Html, ) -> MediaResult<ExtractedMedia>
Extract all media from parsed HTML document
Sourcepub fn extract_images(&self, html: &str) -> MediaResult<Vec<ImageMedia>>
pub fn extract_images(&self, html: &str) -> MediaResult<Vec<ImageMedia>>
Extract only images
Sourcepub fn extract_videos(&self, html: &str) -> MediaResult<Vec<VideoMedia>>
pub fn extract_videos(&self, html: &str) -> MediaResult<Vec<VideoMedia>>
Extract only videos
Sourcepub fn extract_audio(&self, html: &str) -> MediaResult<Vec<AudioMedia>>
pub fn extract_audio(&self, html: &str) -> MediaResult<Vec<AudioMedia>>
Extract only audio
Sourcepub fn extract_documents(&self, html: &str) -> MediaResult<Vec<DocumentMedia>>
pub fn extract_documents(&self, html: &str) -> MediaResult<Vec<DocumentMedia>>
Extract only documents
Sourcepub fn extract_embeds(&self, html: &str) -> MediaResult<Vec<EmbeddedMedia>>
pub fn extract_embeds(&self, html: &str) -> MediaResult<Vec<EmbeddedMedia>>
Extract only embeds
Sourcepub fn get_all_urls(&self, html: &str) -> Vec<String>
pub fn get_all_urls(&self, html: &str) -> Vec<String>
Get all media URLs from HTML
Sourcepub fn get_urls_by_type(&self, html: &str, media_type: MediaType) -> Vec<String>
pub fn get_urls_by_type(&self, html: &str, media_type: MediaType) -> Vec<String>
Get URLs by media type
Sourcepub fn has_media_type(&self, html: &str, media_type: MediaType) -> bool
pub fn has_media_type(&self, html: &str, media_type: MediaType) -> bool
Check if HTML has specific media type
Sourcepub fn count_media(&self, html: &str) -> MediaCounts
pub fn count_media(&self, html: &str) -> MediaCounts
Get media counts by type
Trait Implementations§
Source§impl Clone for MediaExtractor
impl Clone for MediaExtractor
Source§fn clone(&self) -> MediaExtractor
fn clone(&self) -> MediaExtractor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MediaExtractor
impl Debug for MediaExtractor
Source§impl Default for MediaExtractor
impl Default for MediaExtractor
Source§fn default() -> MediaExtractor
fn default() -> MediaExtractor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MediaExtractor
impl RefUnwindSafe for MediaExtractor
impl Send for MediaExtractor
impl Sync for MediaExtractor
impl Unpin for MediaExtractor
impl UnwindSafe for MediaExtractor
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