diff options
author | Andres Rey <[email protected]> | 2016-12-23 19:10:04 -0300 |
---|---|---|
committer | Andres Rey <[email protected]> | 2016-12-23 19:10:04 -0300 |
commit | acf1af50defa03cd5ca884a478c2f214ca650025 (patch) | |
tree | 4e8a315c393feca1bcd275dc9afa015edda0acff /src | |
parent | daaf8cba41f91dd9421f8b4daf376b9d15d8ca0f (diff) |
Updated README and fixed initial options.
Diffstat (limited to 'src')
-rw-r--r-- | src/HTMLParser.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/HTMLParser.php b/src/HTMLParser.php index 9cf0ca8..80ad3fe 100644 --- a/src/HTMLParser.php +++ b/src/HTMLParser.php @@ -98,12 +98,12 @@ class HTMLParser { $defaults = [ 'maxTopCandidates' => 5, // Max amount of top level candidates - 'articleByLine' => null, + 'articleByLine' => false, 'stripUnlikelyCandidates' => true, 'cleanConditionally' => true, 'weightClasses' => true, 'removeReadabilityTags' => true, - 'fixRelativeURLs' => true, + 'fixRelativeURLs' => false, 'originalURL' => 'http://fakehost' ]; @@ -144,6 +144,7 @@ class HTMLParser return false; } + $parseSuccessful = true; while (true) { $root = new Readability($root->firstChild); @@ -171,6 +172,7 @@ class HTMLParser } elseif ($this->getConfig()->getOption('cleanConditionally')) { $this->getConfig()->setOption('cleanConditionally', false); } else { + $parseSuccessful = false; break; } } else { @@ -178,6 +180,10 @@ class HTMLParser } } + if (!$parseSuccessful) { + return false; + } + $result = $this->postProcessContent($result); // Todo, fix return, check for values, maybe create a function to create the return object |