diff --git a/Readability.js b/Readability.js index 2fe64b2..e4a9067 100644 --- a/Readability.js +++ b/Readability.js @@ -141,6 +141,8 @@ Readability.prototype = { jsonLdArticleTypes: /^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/ }, + UNLIKELY_ROLES: [ "menu", "menubar", "complementary", "navigation", "alert", "alertdialog", "dialog" ], + DIV_TO_P_ELEMS: [ "A", "BLOCKQUOTE", "DL", "DIV", "IMG", "OL", "P", "PRE", "TABLE", "UL", "SELECT" ], ALTER_TO_DIV_EXCEPTIONS: ["DIV", "ARTICLE", "SECTION", "P"], @@ -917,8 +919,8 @@ Readability.prototype = { continue; } - if (node.getAttribute("role") == "complementary") { - this.log("Removing complementary content - " + matchString); + if (this.UNLIKELY_ROLES.includes(node.getAttribute("role"))) { + this.log("Removing content with role " + node.getAttribute("role") + " - " + matchString); node = this._removeAndGetNext(node); continue; } diff --git a/test/test-pages/nytimes-1/expected.html b/test/test-pages/nytimes-1/expected.html index 5b3b845..9213f63 100644 --- a/test/test-pages/nytimes-1/expected.html +++ b/test/test-pages/nytimes-1/expected.html @@ -41,9 +41,5 @@ -
- -
\ No newline at end of file diff --git a/test/test-pages/nytimes-2/expected.html b/test/test-pages/nytimes-2/expected.html index 8b8c6de..682edfe 100644 --- a/test/test-pages/nytimes-2/expected.html +++ b/test/test-pages/nytimes-2/expected.html @@ -44,9 +44,5 @@ -
- -
\ No newline at end of file