hsreadability-1.0.0.0: Access to the Readability API.

Safe HaskellNone
LanguageHaskell2010

Network.Readability.Parser

Contents

Description

This module is an interface to the Readability's Parser API.

To get more info, visit https://www.readability.com/developers/api/parser.

Synopsis

Documentation

newtype ParserToken Source

This is a Readability Parser API key.

You can get one at https://www.readability.com/settings/account.

Constructors

ParserToken ByteString 

Parse article

data Article Source

Constructors

Article 

Fields

content :: Maybe Text

The main content of the article (in HTML)

domain :: Maybe Text

Domain name of article host

author :: Maybe Text
 
url :: Text

URL of the article

short_url :: Maybe Text

Shortened URL provided by Readability Shortener

title :: Maybe Text
 
excerpt :: Maybe Text
 
direction :: Maybe Text

Text direction of article

word_count :: Integer
 
total_pages :: Maybe Integer

Total number of pages in article

date_published :: Maybe Text
 
dek :: Maybe Text
 
lead_image_url :: Maybe Text
 
next_page_id :: Maybe Text
 
rendered_pages :: Maybe Int
 

parse Source

Arguments

:: ParserToken

Your Parser API token

-> Maybe ByteString

The article URL

-> Maybe ByteString

The article id

-> Maybe Int

The maximum number of pages to parse

-> IO (Either String Article) 

Parses content of the given article and returns its description.

This is a GET request to /parser endpoint.

parseByUrl :: ParserToken -> ByteString -> Maybe Int -> IO (Either String Article) Source

Parses content of the article by URL.

This is a shortcut for parse.

parseById :: ParserToken -> ByteString -> Maybe Int -> IO (Either String Article) Source

Parses content of the article by article id.

This is a shortcut for parse.

Article status

data ArticleStatus Source

Represents article status

Constructors

ArticleStatus 

Fields

as_article_id :: ByteString

Article id

as_article_status :: Status

Article status

data Status Source

Constructors

Invalid

Unable to parse this URL for some reason

Unretrieved

Readability knows of this article but hasn't yet retrieved its content, or the cache expired

ProvidedByUser

The content of this URL has been retrieved from at least one user

ValidatedByUsers

The content was retrieved from multiple users and is validated

Fetched

The content of this URL was fetched manually, and it has been cached

Instances

getContentStatus Source

Arguments

:: ParserToken

Your Parser API key

-> Maybe ByteString

Article URL

-> Maybe ByteString

Article id

-> IO (Maybe ArticleStatus) 

Gets article's status.

This is a HEAD request to /parser endpoint.

getContentStatusByUrl :: ParserToken -> ByteString -> IO (Maybe ArticleStatus) Source

Gets article's status by URL.

This functions is a shortcut for getContentStatus.

getContentStatusById :: ParserToken -> ByteString -> IO (Maybe ArticleStatus) Source

Gets article's status by id.

This functions is a shortcut for getContentStatus.

Confidence

data Confidence Source

This type represent confidence with which Readability Parser recognizes content of article.

Constructors

Confidence 

Fields

conf_url :: Text

Article URL

conf_confidence :: Double

Parser's confidence

getConfidence Source

Arguments

:: ByteString

Article URL

-> IO (Either String Confidence) 

Gets parser's confidence by URL.

This a GET request to /confidence