summaryrefslogtreecommitdiff
path: root/src/Readability.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2017-11-28 19:26:44 +0000
committerAndres Rey <[email protected]>2017-11-28 19:26:44 +0000
commitf043a9d71d08f285d0035c8505306a8a5bbbaa39 (patch)
tree427641ecee2870d9b3d9519d9c255b05296fb84d /src/Readability.php
parentd1bc52aad329f6bf1d4f88758ea8dc1ba3f37ab8 (diff)
Minor fixes
Diffstat (limited to 'src/Readability.php')
-rw-r--r--src/Readability.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Readability.php b/src/Readability.php
index 452bf95..48da9a5 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -471,7 +471,7 @@ class Readability
*/
if (NodeUtility::hasSinglePNode($node)) {
$pNode = $node->getChildren(true)[0];
- $node->replaceChild($pNode, $node);
+ $node->parentNode->replaceChild($pNode, $node);
$node = $pNode;
$elementsToScore[] = $node;
} elseif (!NodeUtility::hasSingleChildBlockElement($node)) {
@@ -853,7 +853,7 @@ class Readability
if ($sibling->getContentScore() + $contentBonus >= $siblingScoreThreshold) {
$append = true;
} elseif ($sibling->tagNameEqualsTo('p')) {
- $linkDensity = $this->getLinkDensity($sibling);
+ $linkDensity = $siblings->getLinkDensity();
$nodeContent = $sibling->getTextContent(true);
if (mb_strlen($nodeContent) > 80 && $linkDensity < 0.25) {
@@ -873,7 +873,7 @@ class Readability
* Turn it into a div so it doesn't get filtered out later by accident.
*/
- NodeUtility::setNodeTag($siblings, 'div');
+ NodeUtility::setNodeTag($sibling, 'div');
}
$import = $articleContent->importNode($sibling, true);