Discrepancy between firefox reader mode to readability library.

Open
#851 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, nodejs
Domain
web-dev

Research direction

Start by reproducing the supplied PMC article with the shown Node.js, JSDOM, and Readability setup, then compare its output with Firefox Reader View. Investigate why only the References section is selected; done means the discrepancy is explained and a specific correction or configuration requirement is identified.

Written by the indexing model from the issue text.

Description

has-website-testcase parsing-issue reader-mode-has-issues

Hi all,
I have an unresolved problem. I'm figuring out why, in some cases, I get the desired view I want, a full article in Firefox reader view.
but using node js, with JSDOM, resulting in only part of it.

this is the article I'm using:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6540991/

Firefox is parsing it all, from top to bottom.
Using node-js with this library, I get only the 'References' part of the article.
Are there any more configurations that I should consider?

this is my code:

    const jsd = new JSDOM(doc,{
      url,
      referrer: url,
      contentType: "text/html",
      includeNodeLocations: true,
      pretendToBeVisual: true,
    })

    const readable = new Readability(jsd .window?.document, {debug: true }).parse()

using ff reading view:
image

using the readability library:
image

Thanks!

Dominant language
JavaScript
Stars
11.5k
Forks
732
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/readability

All issues in mozilla/readability

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.