@@ -104,7 +104,7 @@ function Readability(doc, options) {
104
104
}
105
105
} ;
106
106
} else {
107
- this . log = function ( ) { } ;
107
+ this . log = function ( ) { } ;
108
108
}
109
109
}
110
110
@@ -671,7 +671,7 @@ Readability.prototype = {
671
671
curTitleWordCount <= 4 &&
672
672
( ! titleHadHierarchicalSeparators ||
673
673
curTitleWordCount !=
674
- wordCount ( origTitle . replace ( / [ \| \- \\ \/ > » ] + / g, "" ) ) - 1 )
674
+ wordCount ( origTitle . replace ( / [ \| \- \\ \/ > » ] + / g, "" ) ) - 1 )
675
675
) {
676
676
curTitle = origTitle ;
677
677
}
@@ -1168,9 +1168,9 @@ Readability.prototype = {
1168
1168
if ( this . UNLIKELY_ROLES . includes ( node . getAttribute ( "role" ) ) ) {
1169
1169
this . log (
1170
1170
"Removing content with role " +
1171
- node . getAttribute ( "role" ) +
1172
- " - " +
1173
- matchString
1171
+ node . getAttribute ( "role" ) +
1172
+ " - " +
1173
+ matchString
1174
1174
) ;
1175
1175
node = this . _removeAndGetNext ( node ) ;
1176
1176
continue ;
@@ -1369,7 +1369,7 @@ Readability.prototype = {
1369
1369
for ( var i = 1 ; i < topCandidates . length ; i ++ ) {
1370
1370
if (
1371
1371
topCandidates [ i ] . readability . contentScore /
1372
- topCandidate . readability . contentScore >=
1372
+ topCandidate . readability . contentScore >=
1373
1373
0.75
1374
1374
) {
1375
1375
alternativeCandidateAncestors . push (
@@ -1497,7 +1497,7 @@ Readability.prototype = {
1497
1497
if (
1498
1498
sibling . readability &&
1499
1499
sibling . readability . contentScore + contentBonus >=
1500
- siblingScoreThreshold
1500
+ siblingScoreThreshold
1501
1501
) {
1502
1502
append = true ;
1503
1503
} else if ( sibling . nodeName === "P" ) {
@@ -1854,7 +1854,7 @@ Readability.prototype = {
1854
1854
1855
1855
const articleAuthor =
1856
1856
typeof values [ "article:author" ] === "string" &&
1857
- ! this . _isUrl ( values [ "article:author" ] )
1857
+ ! this . _isUrl ( values [ "article:author" ] )
1858
1858
? values [ "article:author" ]
1859
1859
: undefined ;
1860
1860
@@ -2042,8 +2042,8 @@ Readability.prototype = {
2042
2042
! node . textContent . trim ( ) . length &&
2043
2043
( ! node . children . length ||
2044
2044
node . children . length ==
2045
- node . getElementsByTagName ( "br" ) . length +
2046
- node . getElementsByTagName ( "hr" ) . length )
2045
+ node . getElementsByTagName ( "br" ) . length +
2046
+ node . getElementsByTagName ( "hr" ) . length )
2047
2047
) ;
2048
2048
} ,
2049
2049
@@ -2493,6 +2493,11 @@ Readability.prototype = {
2493
2493
return t . _readabilityDataTable ;
2494
2494
} ;
2495
2495
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
+
2496
2501
var isList = tag === "ul" || tag === "ol" ;
2497
2502
if ( ! isList ) {
2498
2503
var listLength = 0 ;
0 commit comments