Reader View displays only about half of the article on the New Yorker (broken up by horizontal banner ads)

Open
#660 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
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
content

Research direction

Reproduce the New Yorker URL in Reader View, then start with the candidate-scoring loop shown in the issue, especially the link-density calculation and top-candidate selection. Done means the complete article is retained instead of stopping around the quoted passage, including content separated by horizontal banner ads.

Written by the indexing model from the issue text.

Description

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

I'm feeding this link in to the url https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge and the reader view stops at mid point at ~ "What is the performance of this code going to be?’ He’ll think about all the corner cases almost semi-automatically" and doesn't finish.
I've confirmed that this is also happening in Firefox browser's reader view as well.

Preliminary look suggests that the other half of the text is dropped because it scored lower on the below filtering and doesn't have an overlapping parent that has a higher point than two text children. Has anyone tried to solve this? If so, please guide me to the right place to get started. I will see what I can do!

      var topCandidates = [];
      for (var c = 0, cl = candidates.length; c < cl; c += 1) {
        var candidate = candidates[c];

        // Scale the final candidates score based on link density. Good content
        // should have a relatively small link density (5% or less) and be mostly
        // unaffected by this operation.
        var candidateScore = candidate.readability.contentScore * (1 - this._getLinkDensity(candidate));
        candidate.readability.contentScore = candidateScore;

        this.log("Candidate:", candidate, "with score " + candidateScore);

        for (var t = 0; t < this._nbTopCandidates; t++) {
          var aTopCandidate = topCandidates[t];

          if (!aTopCandidate || candidateScore > aTopCandidate.readability.contentScore) {
            topCandidates.splice(t, 0, candidate);
            if (topCandidates.length > this._nbTopCandidates)
              topCandidates.pop();
            break;
          }
        }
      }

      var topCandidate = topCandidates[0] || null;
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.