From c284ab9bae14994fd792900a77f61001da6dade5 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Sun, 10 Dec 2017 18:11:25 +0000 Subject: Check for minimum html before parsing metadata --- src/Readability.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit v1.2.3