[−][src]Struct extrablatt::extrablatt::Extrablatt
Caches article downloads
Implementations
impl Extrablatt<DefaultExtractor>
[src]
pub fn builder<T: IntoUrl>(url: T) -> Result<ExtrablattBuilder>
[src]
Convenience method for creating a new ExtrablattBuilder
.
Same as calling ExtrablattBuilder::new
.
impl<TExtractor: Extractor> Extrablatt<TExtractor>
[src]
pub fn language(&self) -> &Language
[src]
pub fn config(&self) -> &Config
[src]
The used to store and detect valid articles.
pub fn config_mut(&mut self) -> &mut Config
[src]
pub fn extractor(&self) -> &TExtractor
[src]
The extractor used to retrieve content for an article.
pub fn categories(&self) -> &FnvHashMap<Category, DocumentDownloadState>
[src]
All available categories.
pub fn articles(&self) -> &FnvHashMap<ArticleUrl, DocumentDownloadState>
[src]
All available articles.
pub fn clear(&mut self)
[src]
Clear all cached articles and categories.
pub async fn download_articles<'_, '_>(
&'_ mut self
) -> ArticleDownloadIter<'_, TExtractor>
[src]
&'_ mut self
) -> ArticleDownloadIter<'_, TExtractor>
Download and store all outstanding articles and returns an iterator over their results.
Example
Loop over all downloaded articles.
let mut site = Extrablatt::builder("https://cnn.com/")?.build().await?; site.download_all_remaining_categories().await; for(url, content) in site.download_articles().await.successes() { // ... }
pub fn iter_articles(&self) -> ArticleDownloadIter<'_, TExtractor>
[src]
Iterator over all known articles.
pub async fn download_category<'_, '_>(
&'_ mut self,
category: Category
) -> Result<&'_ Document, ExtrablattError>
[src]
&'_ mut self,
category: Category
) -> Result<&'_ Document, ExtrablattError>
Add a category to the pool and downloads it's content.
If the category is already available it's content is only requested if it hasn't been requested or a previous request failed.
pub async fn retry_download_categories<'_>(
&'_ mut self
) -> Vec<Result<Category, (Category, ExtrablattError)>>
[src]
&'_ mut self
) -> Vec<Result<Category, (Category, ExtrablattError)>>
Retry downloading all missing category documents, including failed previous attempts.
pub async fn download_all_remaining_categories<'_>(
&'_ mut self
) -> Vec<Result<Category, (Category, ExtrablattError)>>
[src]
&'_ mut self
) -> Vec<Result<Category, (Category, ExtrablattError)>>
Download and store all categories and their identified articles that haven't been requested yet.
pub async fn refresh_homepage<'_>(
&'_ mut self
) -> Result<Document, ExtrablattError>
[src]
&'_ mut self
) -> Result<Document, ExtrablattError>
Refresh the main page, insert new categories and return the old document.
impl<TExtractor: Extractor + Unpin> Extrablatt<TExtractor>
[src]
pub fn into_stream(self) -> impl Stream<Item = Result<Article, ExtrablattError>>
[src]
Converts the newspaper into a stream, yielding all available
crate::Article
s.
Trait Implementations
impl<TExtractor: Debug + Extractor> Debug for Extrablatt<TExtractor>
[src]
Auto Trait Implementations
impl<TExtractor = DefaultExtractor> !RefUnwindSafe for Extrablatt<TExtractor>
impl<TExtractor = DefaultExtractor> !Send for Extrablatt<TExtractor>
impl<TExtractor = DefaultExtractor> !Sync for Extrablatt<TExtractor>
impl<TExtractor> Unpin for Extrablatt<TExtractor> where
TExtractor: Unpin,
TExtractor: Unpin,
impl<TExtractor = DefaultExtractor> !UnwindSafe for Extrablatt<TExtractor>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,