limit maximum article length allowed for readability

This commit is contained in:
Andrew Dolgov 2015-10-06 14:12:22 +03:00
parent 86d07d367c
commit 4d03c5c59f
2 changed files with 5 additions and 2 deletions

View File

@ -119,7 +119,7 @@ class Af_Readability extends Plugin {
$tmp = fetch_file_contents($article["link"]);
if ($tmp) {
if ($tmp && mb_strlen($tmp) < 65535 * 4) {
$tmpdoc = new DOMDocument("1.0", "UTF-8");
if (!$tmpdoc->loadHTML($tmp))

View File

@ -261,7 +261,10 @@ class Af_RedditImgur extends Plugin {
$tmp = fetch_file_contents($content_link->getAttribute("href"));
if ($tmp) {
//_debug("tmplen: " . mb_strlen($tmp));
if ($tmp && mb_strlen($tmp) < 65535 * 4) {
$r = new Readability($tmp, $content_link->getAttribute("href"));
if ($r->init()) {