Cleanup the HTML before parsing it.

This commit is contained in:
Michael Vogel 2014-12-08 14:26:44 +01:00
parent c398974918
commit 620ee6be0b
1 changed files with 5 additions and 0 deletions

View File

@ -263,6 +263,11 @@ function scrape_feed($url) {
}
try {
// Cleanup invalid HTML
$doc = new DOMDocument();
@$doc->loadHTML($s);
$s = $doc->saveHTML();
$dom = HTML5_Parser::parse($s);
} catch (DOMException $e) {
logger('scrape_feed: parse error: ' . $e);