[][src]Struct extrablatt::extrablatt::Extrablatt

pub struct Extrablatt<TExtractor: Extractor = DefaultExtractor> { /* fields omitted */ }

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]

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]

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]

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]

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]

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::Articles.

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

impl<TExtractor = DefaultExtractor> !UnwindSafe for Extrablatt<TExtractor>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,