mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
Backport some logics from mozilla/readability
This change backports several things from mozilla/readability: - Add child score to all ancestors instead of the first parent only - Check 5 top candidates and try to find alternative candidates within ancestors, this can help to find a better parent and grab more content - Reduce patterns from `unlikelyCandidates` to the one used by Mozilla as ours tend to remove useful nodes - Score headers (h2 to h6) by default in addition to div, p, td and section Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
@@ -201,7 +201,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEmpty($readability->getTitle()->getInnerHtml());
|
||||
$this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringNotContainsString('<aside>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('<footer readability="5"/>', $readability->getContent()->getInnerHtml());
|
||||
$this->assertStringContainsString('<footer readability="9"/>', $readability->getContent()->getInnerHtml());
|
||||
}
|
||||
|
||||
public function testWithClasses(): void
|
||||
|
||||
Reference in New Issue
Block a user