diff options
author | Andres Rey <[email protected]> | 2018-09-02 20:41:39 +0100 |
---|---|---|
committer | Andres Rey <[email protected]> | 2018-09-02 20:41:39 +0100 |
commit | 18b61354ce2d0c2133b82b54254a9239ec5a5fe1 (patch) | |
tree | 004e659667e25952d0bb14b3b9af23959a2c8f52 /src/Readability.php | |
parent | 84dcd2b1c8907e2e102ad05f8142e3d3b1ab3ede (diff) |
Check for visible nodes before parsing
Diffstat (limited to 'src/Readability.php')
-rw-r--r-- | src/Readability.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Readability.php b/src/Readability.php index 2cad398..f913d80 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -626,6 +626,12 @@ class Readability $matchString = $node->getAttribute('class') . ' ' . $node->getAttribute('id'); + if (!$node->isProbablyVisible()) { + $this->logger->debug(sprintf('[Get Nodes] Removing hidden node... Match string was: \'%s\'', $matchString)); + $node = NodeUtility::removeAndGetNext($node); + continue; + } + // Check to see if this node is a byline, and remove it if it is. if ($this->checkByline($node, $matchString)) { $this->logger->debug(sprintf('[Get Nodes] Found byline, removing... Node content was: \'%s\'', substr($node->nodeValue, 0, 128))); |