Readability::Document
Inherits Reference / Object
Constants
ELEMENT_SCORES = {"div" => 5.0, "blockquote" => 3.0, "form" => -3.0, "th" => -5.0}
PARSE_OPTS = (XML::HTMLParserOptions::NODEFDTD | XML::HTMLParserOptions::NOIMPLIED) | XML::HTMLParserOptions::NOBLANKS
REGEXES = {:unlikelyCandidatesRe => /combx|comment|community|disqus|extra|foot|footer|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|search/i, :okMaybeItsACandidateRe => /and|article|body|column|main|shadow/i, :positiveRe => /article|body|content|entry|hentry|main|page|pagination|post|text|blog|story/i, :negativeRe => /combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget/i, :divToPElementsRe => /<(a|blockquote|dl|div|img|ol|p|pre|table|ul)/i, :replaceBrsRe => /(?<content>.*)(<br[^>]*>[ \n\r\t]*){2,}/i, :replaceFontsRe => /<(\/?)font[^>]*>/i, :trimRe => /^\s+|\s+$/, :normalizeRe => /\s{2,}/, :killBreaksRe => /(<br\s*\/?>(\s| ?)*){1,}/, :videoRe => /http:\/\/(www\.)?(youtube|vimeo)\.com/i}
SAVE_OPTS = (XML::SaveOptions::NO_DECL | XML::SaveOptions::AS_HTML) | XML::SaveOptions::NO_EMPTY
Constructors
Class methods
css_query_to_xpath(query : String) : String
Transform the css query into an xpath query https://github.com/madeindjs/Crystagiri/blob/master/src/crystagiri/html.cr
html_from_input(input, options = XML::HTMLParserOptions::NODEFDTD)
SourceInstance methods
author
Look through the @html document looking for the author Precedence Information here on the wiki: (TODO: attach wiki URL if it is accepted) Returns nil if no author is detected
best_candidate_has_image
Sourcebest_candidate_has_image=(best_candidate_has_image : Bool)
Sourceclass_weight(e)
Sourceclean_conditionally(node, candidates, selector)
Sourceclean_conditionally_reason?(name, counts, content_length, weight, link_density)
Sourcecontent(remove_unlikely_candidates = :default)
Sourcedebug(str)
Sourceget_article(candidates, best_candidate)
Sourceget_link_density(elem)
Sourcehandle_exclusions!(whitelist, blacklist)
Sourcehtml
Sourcehtml=(html : XML::Node)
Sourcemeta_image
Sourceoptions
Sourceoptions=(options : Readability::Options)
Sourceremove_unlikely_candidates!
Sourcesanitize(node, candidates = {} of Any => Any)
Sourcescore_node(elem)
Sourceselect_best_candidate(candidates)
Sourcetitle
Sourcetransform_misused_divs_into_paragraphs!
Source