mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 13:25:54 +00:00
af_readability: add a workaround for meta charset html pages
This commit is contained in:
@@ -101,6 +101,19 @@ class Af_Readability extends Plugin {
|
||||
$tmp = fetch_file_contents($article["link"]);
|
||||
|
||||
if ($tmp) {
|
||||
$tmpdoc = new DOMDocument("1.0", "UTF-8");
|
||||
$tmpdoc->loadHTML($tmp);
|
||||
|
||||
if ($tmpdoc->encoding != 'UTF-8') {
|
||||
$tmpxpath = new DOMXPath($tmpdoc);
|
||||
|
||||
foreach ($tmpxpath->query("//meta") as $elem) {
|
||||
$elem->parentNode->removeChild($elem);
|
||||
}
|
||||
|
||||
$tmp = $tmpdoc->saveHTML();
|
||||
}
|
||||
|
||||
$r = new Readability($tmp, $article["link"]);
|
||||
|
||||
if ($r->init()) {
|
||||
|
||||
Reference in New Issue
Block a user