diff options
author | Andres Rey <[email protected]> | 2017-12-10 18:11:25 +0000 |
---|---|---|
committer | Andres Rey <[email protected]> | 2017-12-10 18:11:25 +0000 |
commit | c284ab9bae14994fd792900a77f61001da6dade5 (patch) | |
tree | b035db1424218b28df900e815ffe084aa995adc7 /src | |
parent | 1cbc9d5aaf9979bf6fd07f2a94ed6d922ead1e0b (diff) |
Check for minimum html before parsing metadata
Diffstat (limited to 'src')
-rw-r--r-- | src/Readability.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Readability.php b/src/Readability.php index 97b6597..48aff05 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -126,15 +126,15 @@ class Readability { $this->dom = $this->loadHTML($html); - $this->getMetadata(); - - $this->getMainImage(); - // Checking for minimum HTML to work with. if (!($root = $this->dom->getElementsByTagName('body')->item(0)) || !$root->firstChild) { throw new ParseException('Invalid or incomplete HTML.'); } + $this->getMetadata(); + + $this->getMainImage(); + while (true) { $root = $root->firstChild; |