Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is an interface to the Readability's Parser API.
To get more info, visit https://www.readability.com/developers/api/parser.
- newtype ParserToken = ParserToken ByteString
- data Article = Article {
- content :: Maybe Text
- domain :: Maybe Text
- author :: Maybe Text
- url :: Text
- short_url :: Maybe Text
- title :: Maybe Text
- excerpt :: Maybe Text
- direction :: Maybe Text
- word_count :: Integer
- total_pages :: Maybe Integer
- date_published :: Maybe Text
- dek :: Maybe Text
- lead_image_url :: Maybe Text
- next_page_id :: Maybe Text
- rendered_pages :: Maybe Int
- parse :: ParserToken -> Maybe ByteString -> Maybe ByteString -> Maybe Int -> IO (Either String Article)
- parseByUrl :: ParserToken -> ByteString -> Maybe Int -> IO (Either String Article)
- parseById :: ParserToken -> ByteString -> Maybe Int -> IO (Either String Article)
- data ArticleStatus = ArticleStatus {}
- data Status
- getContentStatus :: ParserToken -> Maybe ByteString -> Maybe ByteString -> IO (Maybe ArticleStatus)
- getContentStatusByUrl :: ParserToken -> ByteString -> IO (Maybe ArticleStatus)
- getContentStatusById :: ParserToken -> ByteString -> IO (Maybe ArticleStatus)
- data Confidence = Confidence {}
- getConfidence :: ByteString -> IO (Either String Confidence)
Documentation
newtype ParserToken Source
This is a Readability Parser API key.
You can get one at https://www.readability.com/settings/account.
Parse article
Article | |
|
:: 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
ArticleStatus | |
|
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 |
:: 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.
Confidence | |
|
:: ByteString | Article URL |
-> IO (Either String Confidence) |
Gets parser's confidence by URL.
This a GET
request to /confidence