Skip to content

Crashes on all Pinterest and many other websites, minimal reproductionΒ #836

Closed as not planned
@koresar

Description

@koresar
const html = `
<div><div><div>
More than 25 characters!!
</div></div></div>
<div><meta name="twitter:title" content="1"></div>`;

const doc = new DOMParser().parseFromString(html, 'text/html')
const base = doc.createElement('base')
base.setAttribute('href', url)
doc.head.appendChild(base)
const reader = new Readability(doc, {
    keepClasses: true,
})

const result = reader.parse(); // crashes here

Stack trace:

TypeError: Cannot read properties of null (reading 'tagName')
    at Readability._grabArticle (node_modules/@extractus/article-extractor/node_modules/@mozilla/readability/Readability.js:1147:37)
    at Readability.parse (node_modules/@extractus/article-extractor/node_modules/@mozilla/readability/Readability.js:2265:31)

Pages to test on:

I couldn't fix myself. Sorry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions