Skip to main content
Home

Built and signed on GitHub Actions

The cheerio port of readability.js

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
7 months ago (0.1.2)
type alias Options

Options for the Readability library. All options are optional.

  • debug (boolean, default false): whether to enable logging.
  • maxElemsToParse (number, default 0 i.e. no limit): the maximum number of elements to parse.
  • nbTopCandidates (number, default 5): the number of top candidates to consider when analysing how tight the competition is among candidates.
  • charThreshold (number, default 500): the number of characters an article must have in order to return a result.
  • classesToPreserve (array): a set of classes to preserve on HTML elements when the keepClasses options is set to false.
  • keepClasses (boolean, default false): whether to preserve all classes on HTML elements. When set to false only classes specified in the classesToPreserve array are kept.
  • disableJSONLD (boolean, default false): when extracting page metadata, cheer-reader gives precedence to Schema.org fields specified in the JSON-LD format. Set this option to true to skip JSON-LD parsing.
  • serializer (function, default $el => $el.html()) controls how the content property returned by the parse() method is produced from the root DOM element. It may be useful to specify the serializer as the identity function ($el => $el) to obtain a cheerio element instead of a string for content if you plan to process it further.
  • allowedVideoRegex (RegExp, default undefined ): a regular expression that matches video URLs that should be allowed to be included in the article content. If undefined, the default regex is applied.
  • linkDensityModifier (number, default 0): a number that is added to the base link density threshold during the shadiness checks. This can be used to penalize nodes with a high link density or vice versa.
  • extraction (boolean, default true): Some libraries are only interested on the metadata and don't want to pay the price of a full extraction. When you enable this option the content, textContent, length and excerpt will be null.

Properties

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@paoramen/cheer-reader

Import symbol

import { type Options } from "@paoramen/cheer-reader";
or

Import directly with a jsr specifier

import { type Options } from "jsr:@paoramen/cheer-reader";

Add Package

pnpm i jsr:@paoramen/cheer-reader
or (using pnpm 10.8 or older)
pnpm dlx jsr add @paoramen/cheer-reader

Import symbol

import { type Options } from "@paoramen/cheer-reader";

Add Package

yarn add jsr:@paoramen/cheer-reader
or (using Yarn 4.8 or older)
yarn dlx jsr add @paoramen/cheer-reader

Import symbol

import { type Options } from "@paoramen/cheer-reader";

Add Package

npx jsr add @paoramen/cheer-reader

Import symbol

import { type Options } from "@paoramen/cheer-reader";

Add Package

bunx jsr add @paoramen/cheer-reader

Import symbol

import { type Options } from "@paoramen/cheer-reader";