@@ -104,7 +104,7 @@ function Readability(doc, options) {
104104 }
105105 } ;
106106 } else {
107- this . log = function ( ) { } ;
107+ this . log = function ( ) { } ;
108108 }
109109}
110110
@@ -671,7 +671,7 @@ Readability.prototype = {
671671 curTitleWordCount <= 4 &&
672672 ( ! titleHadHierarchicalSeparators ||
673673 curTitleWordCount !=
674- wordCount ( origTitle . replace ( / [ \| \- \\ \/ > » ] + / g, "" ) ) - 1 )
674+ wordCount ( origTitle . replace ( / [ \| \- \\ \/ > » ] + / g, "" ) ) - 1 )
675675 ) {
676676 curTitle = origTitle ;
677677 }
@@ -1168,9 +1168,9 @@ Readability.prototype = {
11681168 if ( this . UNLIKELY_ROLES . includes ( node . getAttribute ( "role" ) ) ) {
11691169 this . log (
11701170 "Removing content with role " +
1171- node . getAttribute ( "role" ) +
1172- " - " +
1173- matchString
1171+ node . getAttribute ( "role" ) +
1172+ " - " +
1173+ matchString
11741174 ) ;
11751175 node = this . _removeAndGetNext ( node ) ;
11761176 continue ;
@@ -1369,7 +1369,7 @@ Readability.prototype = {
13691369 for ( var i = 1 ; i < topCandidates . length ; i ++ ) {
13701370 if (
13711371 topCandidates [ i ] . readability . contentScore /
1372- topCandidate . readability . contentScore >=
1372+ topCandidate . readability . contentScore >=
13731373 0.75
13741374 ) {
13751375 alternativeCandidateAncestors . push (
@@ -1497,7 +1497,7 @@ Readability.prototype = {
14971497 if (
14981498 sibling . readability &&
14991499 sibling . readability . contentScore + contentBonus >=
1500- siblingScoreThreshold
1500+ siblingScoreThreshold
15011501 ) {
15021502 append = true ;
15031503 } else if ( sibling . nodeName === "P" ) {
@@ -1854,7 +1854,7 @@ Readability.prototype = {
18541854
18551855 const articleAuthor =
18561856 typeof values [ "article:author" ] === "string" &&
1857- ! this . _isUrl ( values [ "article:author" ] )
1857+ ! this . _isUrl ( values [ "article:author" ] )
18581858 ? values [ "article:author" ]
18591859 : undefined ;
18601860
@@ -2042,8 +2042,8 @@ Readability.prototype = {
20422042 ! node . textContent . trim ( ) . length &&
20432043 ( ! node . children . length ||
20442044 node . children . length ==
2045- node . getElementsByTagName ( "br" ) . length +
2046- node . getElementsByTagName ( "hr" ) . length )
2045+ node . getElementsByTagName ( "br" ) . length +
2046+ node . getElementsByTagName ( "hr" ) . length )
20472047 ) ;
20482048 } ,
20492049
@@ -2493,6 +2493,11 @@ Readability.prototype = {
24932493 return t . _readabilityDataTable ;
24942494 } ;
24952495
2496+ if ( node . readability && node . readability . contentScore > 50 ) {
2497+ this . log ( "Protecting high-score element:" , node , "score:" , node . readability . contentScore ) ;
2498+ return false ;
2499+ }
2500+
24962501 var isList = tag === "ul" || tag === "ol" ;
24972502 if ( ! isList ) {
24982503 var listLength = 0 ;
0 commit comments