{"id":13491723,"url":"https://github.com/mozilla/readability","last_synced_at":"2025-09-09T20:56:13.420Z","repository":{"id":26773758,"uuid":"30231828","full_name":"mozilla/readability","owner":"mozilla","description":"A standalone version of the readability lib","archived":false,"fork":false,"pushed_at":"2025-08-15T11:19:32.000Z","size":6900,"stargazers_count":10369,"open_issues_count":284,"forks_count":672,"subscribers_count":103,"default_branch":"main","last_synced_at":"2025-08-30T18:33:18.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mozilla.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-02-03T08:01:54.000Z","updated_at":"2025-08-30T18:19:38.000Z","dependencies_parsed_at":"2023-02-11T20:00:35.040Z","dependency_job_id":"c3359d8d-1c3f-4820-9d4d-bdf73ef8a6e7","html_url":"https://github.com/mozilla/readability","commit_stats":{"total_commits":418,"total_committers":89,"mean_commits":4.696629213483146,"dds":0.6770334928229664,"last_synced_commit":"65578aeba436aa7dbaa16ceadc89b7ebd6dc6035"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/mozilla/readability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Freadability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Freadability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Freadability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Freadability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozilla","download_url":"https://codeload.github.com/mozilla/readability/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Freadability/sbom","scorecard":{"id":662320,"data":{"date":"2025-08-11","repo":{"name":"github.com/mozilla/readability","commit":"81fac1abb2e5503c8b4da49e6632b6ebc8d7cb09"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.7,"checks":[{"name":"Maintained","score":3,"reason":"4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":8,"reason":"Found 22/27 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T16:33:52.638Z","repository_id":26773758,"created_at":"2025-08-21T16:33:52.638Z","updated_at":"2025-08-21T16:33:52.638Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274361542,"owners_count":25271259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:00:59.658Z","updated_at":"2025-09-09T20:56:13.369Z","avatar_url":"https://github.com/mozilla.png","language":"JavaScript","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 `\u003ciframe\u003e` 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 =\u003e 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 =\u003e 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(\"\u003cbody\u003eLook at this cat: \u003cimg src='./cat.jpg'\u003e\u003c/body\u003e\", {\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","funding_links":[],"categories":["JavaScript","Repository","URI Handler","📝 Content \u0026 Text Extraction","Libraries","HarmonyOS","others"],"sub_categories":["Parsing","Ruby","Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Freadability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozilla%2Freadability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Freadability/lists"}