{"_id":"@mozilla/readability","_rev":"4203438","name":"@mozilla/readability","description":"A standalone version of the readability library used for Firefox Reader View.","dist-tags":{"latest":"0.6.0"},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"time":{"modified":"2026-03-04T17:02:39.000Z","created":"2020-08-05T22:08:16.400Z","0.6.0":"2025-03-03T21:50:47.343Z","0.5.0":"2023-12-15T17:20:22.092Z","0.4.4":"2023-03-31T16:15:12.578Z","0.4.3":"2023-03-22T10:22:46.945Z","0.4.2":"2022-02-09T15:59:10.181Z","0.4.1":"2021-01-22T15:36:59.111Z","0.4.0":"2020-12-23T17:57:07.483Z","0.3.0":"2020-08-05T22:08:16.400Z"},"users":{},"author":"","repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"versions":{"0.6.0":{"name":"@mozilla/readability","version":"0.6.0","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint . && prettier Readability.js JSDOMParser.js test/*.js --check","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=14.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"5.0.0","chai":"4.3.7","eslint":"8.57.0","eslint-plugin-mozilla":"^3.7.4","eslint-plugin-no-unsanitized":"^4.0.2","htmltidy2":"1.0.0","js-beautify":"1.14.7","jsdom":"20.0.2","mocha":"10.8.2","prettier":"^3.3.2","release-it":"17.0.1","sinon":"14.0.2","xml-name-validator":"^5.0.0"},"_id":"@mozilla/readability@0.6.0","gitHead":"4d5dd0bbe0bfbc44e219dc86865131e79639e30b","_nodeVersion":"23.5.0","_npmVersion":"10.9.2","dist":{"shasum":"134e3ce3ff1676716e550de0b8de957bcc59208b","size":43359,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.6.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.6.0.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/readability_0.6.0_1741038647143_0.8742147294952951"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-03-03T21:50:47.343Z","publish_time":1741038647343,"_source_registry_name":"default","_cnpm_publish_time":1741038647343},"0.5.0":{"name":"@mozilla/readability","version":"0.5.0","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=14.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"5.0.0","chai":"4.3.7","eslint":"8.27.0","htmltidy2":"1.0.0","js-beautify":"1.14.7","jsdom":"20.0.2","mocha":"10.1.0","release-it":"17.0.1","sinon":"14.0.2"},"gitHead":"83366f8998cfa6fd92f5169d9f634b8c92a066f7","_id":"@mozilla/readability@0.5.0","_nodeVersion":"19.5.0","_npmVersion":"9.6.2","dist":{"shasum":"a6d5055bbadd0f329cc3e72089d4f176ed96c1d5","size":42205,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.5.0.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.5.0_1702660821918_0.7790252331465206"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-12-15T17:20:22.092Z","publish_time":1702660822092,"_source_registry_name":"default","_cnpm_publish_time":1702660822092},"0.4.4":{"name":"@mozilla/readability","version":"0.4.4","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=14.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"3.1.0","chai":"4.3.7","eslint":"8.27.0","htmltidy2":"1.0.0","js-beautify":"1.14.7","jsdom":"20.0.2","mocha":"10.1.0","release-it":"15.5.0","sinon":"14.0.2"},"gitHead":"2333080231e62b5d1212058bf20ed8e1a7c62040","_id":"@mozilla/readability@0.4.4","_nodeVersion":"19.5.0","_npmVersion":"9.6.2","dist":{"shasum":"5d258b3436eba1d5fe31c4386e50a848d5cb5811","size":41880,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.4.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.4.4.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.4.4_1680279312404_0.9246651791440044"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-31T16:15:12.578Z","publish_time":1680279312578,"_cnpm_publish_time":1680279312578},"0.4.3":{"name":"@mozilla/readability","version":"0.4.3","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=14.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"3.1.0","chai":"4.3.7","eslint":"8.27.0","htmltidy2":"1.0.0","js-beautify":"1.14.7","jsdom":"20.0.2","mocha":"10.1.0","release-it":"15.5.0","sinon":"14.0.2"},"gitHead":"cf944a58baf4ea0383c0bf8ac5d689c492041de5","_id":"@mozilla/readability@0.4.3","_nodeVersion":"19.5.0","_npmVersion":"9.6.2","dist":{"shasum":"753c453d9078972319402550d08e36330ec38457","size":41793,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.4.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.4.3.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.4.3_1679480566802_0.12825847572171023"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-22T10:22:46.945Z","publish_time":1679480566945,"_cnpm_publish_time":1679480566945},"0.4.2":{"name":"@mozilla/readability","version":"0.4.2","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=10.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"^2.2.2","chai":"^2.1.*","eslint":"^7.26.0","htmltidy2":"^0.3.0","js-beautify":"^1.13.13","jsdom":"^13.1","mocha":"^8.4.0","release-it":"^14.6.2","sinon":"^7.3.2"},"gitHead":"629989e814f12b392ade9cc219d3cd44b0211bfe","_id":"@mozilla/readability@0.4.2","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"a425f3dccdbe777d45a4e791bd703ebe633ebb87","size":40719,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.4.2.tgz"},"_npmUser":{"name":"tigleym","email":"tigleym@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.4.2_1644422350010_0.5711967249481513"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-09T15:59:17.964Z","publish_time":1644422350181,"_cnpm_publish_time":1644422350181},"0.4.1":{"name":"@mozilla/readability","version":"0.4.1","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=10.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"^2.2.2","chai":"^2.1.*","eslint":">=4.2","htmltidy2":"^0.3.0","js-beautify":"^1.13.0","jsdom":"^13.1","mocha":"^8.2.0","release-it":"^14.2.2","sinon":"^7.3.2"},"gitHead":"49bc5bfcc7704adc928dcd17e477fd36fd9f5679","_id":"@mozilla/readability@0.4.1","_nodeVersion":"14.13.1","_npmVersion":"6.14.8","dist":{"shasum":"e112a625b25ac47659d33b37e080748a6d85218b","size":39565,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.4.1.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.4.1_1611329818934_0.29300615820086695"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-20T10:58:54.535Z","publish_time":1611329819111,"_cnpm_publish_time":1611329819111},"0.4.0":{"name":"@mozilla/readability","version":"0.4.0","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","perf":"matcha benchmarks/benchmarks.js","perf-reference":"READABILITY_PERF_REFERENCE=1 matcha --reporter ./benchmarks/benchmark-reporter.js benchmarks/benchmarks.js","release":"release-it"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=10.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"@release-it/keep-a-changelog":"^2.2.2","chai":"^2.1.*","eslint":">=4.2","htmltidy2":"^0.3.0","js-beautify":"^1.13.0","jsdom":"^13.1","matcha":"^0.6.0","mocha":"^8.2.0","release-it":"^14.2.2","sinon":"^7.3.2"},"gitHead":"ee105d9c9ab39d70d11fcbb3be017e699c615324","_id":"@mozilla/readability@0.4.0","_nodeVersion":"14.13.1","_npmVersion":"6.14.8","dist":{"shasum":"e514ae529a3edd835ebf0c47b97ede3965140e23","size":39160,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.4.0.tgz"},"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.4.0_1608746227294_0.3816542924202164"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-20T10:58:53.677Z","publish_time":1608746227483,"_cnpm_publish_time":1608746227483},"0.3.0":{"name":"@mozilla/readability","version":"0.3.0","description":"A standalone version of the readability library used for Firefox Reader View.","main":"index.js","scripts":{"lint":"eslint .","test":"mocha test/test-*.js","generate-testcase":"node test/generate-testcase.js","perf":"matcha benchmarks/benchmarks.js","perf-reference":"READABILITY_PERF_REFERENCE=1 matcha --reporter ./benchmarks/benchmark-reporter.js benchmarks/benchmarks.js"},"repository":{"type":"git","url":"git+https://github.com/mozilla/readability.git"},"author":"","license":"Apache-2.0","bugs":{"url":"https://github.com/mozilla/readability/issues"},"engines":{"node":">=10.0.0"},"homepage":"https://github.com/mozilla/readability","devDependencies":{"chai":"^2.1.*","eslint":">=4.2","htmltidy2":"^0.3.0","js-beautify":"^1.5.5","jsdom":"^13.1","matcha":"^0.6.0","mocha":"^2.2.*","sinon":"^7.3.2"},"gitHead":"80d818aaa695984cdafe8c981681dc14b7c904e5","_id":"@mozilla/readability@0.3.0","_nodeVersion":"14.4.0","_npmVersion":"6.14.7","dist":{"shasum":"a473790e8b42ea39f9f03703fa1f17fec7984b60","size":36618,"noattachment":false,"key":"/@mozilla/readability/-/@mozilla/readability-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@mozilla/readability/download/@mozilla/readability-0.3.0.tgz"},"maintainers":[{"name":"cmkm","email":""},{"name":"fchasen","email":""},{"name":"gijs","email":"gijskruitbosch@gmail.com"}],"_npmUser":{"name":"gijs","email":"gijskruitbosch@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readability_0.3.0_1596665296221_0.18185745535345732"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-20T10:58:51.875Z","publish_time":1596665296400,"_cnpm_publish_time":1596665296400}},"readme":"# Readability.js\n\nA standalone version of the readability library used for [Firefox Reader View](https://support.mozilla.org/kb/firefox-reader-view-clutter-free-web-pages).\n\n## Installation\n\nReadability is available on npm:\n\n```bash\nnpm install @mozilla/readability\n```\n\nYou can then `require()` it, or for web-based projects, load the `Readability.js` script from your webpage.\n\n## Basic usage\n\nTo parse a document, you must create a new `Readability` object from a DOM document object, and then call the [`parse()`](#parse) method. Here's an example:\n\n```javascript\nvar article = new Readability(document).parse();\n```\n\nIf you use Readability in a web browser, you will likely be able to use a `document` reference from elsewhere (e.g. fetched via XMLHttpRequest, in a same-origin `<iframe>` you have access to, etc.). In Node.js, you can [use an external DOM library](#nodejs-usage).\n\n## API Reference\n\n### `new Readability(document, options)`\n\nThe `options` object accepts a number of properties, all optional:\n\n* `debug` (boolean, default `false`): whether to enable logging.\n* `maxElemsToParse` (number, default `0` i.e. no limit): the maximum number of elements to parse.\n* `nbTopCandidates` (number, default `5`): the number of top candidates to consider when analysing how tight the competition is among candidates.\n* `charThreshold` (number, default `500`): the number of characters an article must have in order to return a result.\n* `classesToPreserve` (array): a set of classes to preserve on HTML elements when the `keepClasses` options is set to `false`.\n* `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.\n* `disableJSONLD` (boolean, default `false`): when extracting page metadata, Readability gives precedence to Schema.org fields specified in the JSON-LD format. Set this option to `true` to skip JSON-LD parsing.\n* `serializer` (function, default `el => el.innerHTML`) 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 DOM element instead of a string for `content` if you plan to process it further.\n* `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](https://github.com/mozilla/readability/blob/8e8ec27cd2013940bc6f3cc609de10e35a1d9d86/Readability.js#L133) is applied.\n* `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.\n\n### `parse()`\n\nReturns an object containing the following properties:\n\n* `title`: article title;\n* `content`: HTML string of processed article content;\n* `textContent`: text content of the article, with all the HTML tags removed;\n* `length`: length of an article, in characters;\n* `excerpt`: article description, or short excerpt from the content;\n* `byline`: author metadata;\n* `dir`: content direction;\n* `siteName`: name of the site;\n* `lang`: content language;\n* `publishedTime`: published time;\n\nThe `parse()` method works by modifying the DOM. This removes some elements in the web page, which may be undesirable. You can avoid this by passing the clone of the `document` object to the `Readability` constructor:\n\n```js\nvar documentClone = document.cloneNode(true);\nvar article = new Readability(documentClone).parse();\n```\n\n### `isProbablyReaderable(document, options)`\n\nA quick-and-dirty way of figuring out if it's plausible that the contents of a given document are suitable for processing with Readability. It is likely to produce both false positives and false negatives. The reason it exists is to avoid bogging down a time-sensitive process (like loading and showing the user a webpage) with the complex logic in the core of Readability. Improvements to its logic (while not deteriorating its performance) are very welcome.\n\nThe `options` object accepts a number of properties, all optional:\n\n* `minContentLength` (number, default `140`): the minimum node content length used to decide if the document is readerable;\n* `minScore` (number, default `20`): the minimum cumulated 'score' used to determine if the document is readerable;\n* `visibilityChecker` (function, default `isNodeVisible`): the function used to determine if a node is visible;\n\nThe function returns a boolean corresponding to whether or not we suspect `Readability.parse()` will succeed at returning an article object. Here's an example:\n\n```js\n/*\n    Only instantiate Readability  if we suspect\n    the `parse()` method will produce a meaningful result.\n*/\nif (isProbablyReaderable(document)) {\n    let article = new Readability(document).parse();\n}\n```\n\n## Node.js usage\n\nSince Node.js does not come with its own DOM implementation, we rely on external libraries like [jsdom](https://github.com/jsdom/jsdom). Here's an example using `jsdom` to obtain a DOM document object:\n\n```js\nvar { Readability } = require('@mozilla/readability');\nvar { JSDOM } = require('jsdom');\nvar doc = new JSDOM(\"<body>Look at this cat: <img src='./cat.jpg'></body>\", {\n  url: \"https://www.example.com/the-page-i-got-the-source-from\"\n});\nlet reader = new Readability(doc.window.document);\nlet article = reader.parse();\n```\n\nRemember to pass the page's URI as the `url` option in the `JSDOM` constructor (as shown in the example above), so that Readability can convert relative URLs for images, hyperlinks, etc. to their absolute counterparts.\n\n`jsdom` has the ability to run the scripts included in the HTML and fetch remote resources. For security reasons these are [disabled by default](https://github.com/jsdom/jsdom#executing-scripts), and we **strongly** recommend you keep them that way.\n\n## Security\n\nIf you're going to use Readability with untrusted input (whether in HTML or DOM form), we **strongly** recommend you use a sanitizer library like [DOMPurify](https://github.com/cure53/DOMPurify) to avoid script injection when you use\nthe output of Readability. We would also recommend using [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) to add further defense-in-depth\nrestrictions to what you allow the resulting content to do. The Firefox integration of\nreader mode uses both of these techniques itself. Sanitizing unsafe content out of the input is explicitly not something we aim to do as part of Readability itself - there are other good sanitizer libraries out there, use them!\n\n## Contributing\n\nPlease see our [Contributing](CONTRIBUTING.md) document.\n\n## License\n\n    Copyright (c) 2010 Arc90 Inc\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","_attachments":{},"homepage":"https://github.com/mozilla/readability","bugs":{"url":"https://github.com/mozilla/readability/issues"},"license":"Apache-2.0"}