[][src]Struct extrablatt::article::Article

pub struct Article {
    pub url: Url,
    pub doc: Document,
    pub content: ArticleContent<'static>,
    pub language: Language,
}

A full representation of a news article.

Example

Download a single article directly

    let article = Article::builder("http://example.com/")?.get().await?;

Fields

url: Url

The url of the article.

doc: Document

The parsed response html Document.

content: ArticleContent<'static>

The extracted content of the article.

language: Language

The expected language of the article.

Implementations

impl Article[src]

pub fn new<U: IntoUrl, T: AsRef<str>>(url: U, doc: T) -> Result<Article>[src]

Extract the article directly from the doc using the DefaultExtractor

pub fn with_extractor<U, T, TExtract>(
    url: U,
    doc: T,
    extractor: &TExtract
) -> Result<Article> where
    U: IntoUrl,
    T: AsRef<str>,
    TExtract: Extractor
[src]

pub fn with_extractor_and_lang<U, T, TExtract>(
    url: U,
    doc: T,
    extractor: &TExtract,
    language: Language
) -> Result<Article> where
    U: IntoUrl,
    T: AsRef<str>,
    TExtract: Extractor
[src]

Extract the article directly from the doc using the provided extractor and lang

pub async fn content<T: IntoUrl>(url: T) -> Result<ArticleContent<'static>>[src]

Retrieves the ArticleContent from the url

Convenience method for:

       let content = Article::builder("http://example.com")?.get().await?.content;

pub async fn get<T: IntoUrl>(url: T) -> Result<Article>[src]

Get the Article for the url

pub async fn get_with_extractor<T: IntoUrl, TExtract: Extractor, '_>(
    url: T,
    extractor: &'_ TExtract
) -> Result<Article>
[src]

Get the Article for the url using a specific Extractor

pub fn builder<T: IntoUrl>(url: T) -> Result<ArticleBuilder>[src]

Convenience method for creating a new ArticleBuilder

Same as calling ArticleBuilder::new

pub fn drop_document(self) -> PureArticle[src]

Drops the article's html select::document::Document.

Trait Implementations

impl Debug for Article[src]

Auto Trait Implementations

impl !RefUnwindSafe for Article

impl !Send for Article

impl !Sync for Article

impl Unpin for Article

impl UnwindSafe for Article

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.