From b045da0e5e353e149b2df966028c6b22c13ebe9d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 26 Nov 2024 20:08:44 +0300 Subject: [PATCH] add af_comics filter for The Oatmeal --- .../filters/af_comics_theoatmeal.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 plugins/af_comics/filters/af_comics_theoatmeal.php diff --git a/plugins/af_comics/filters/af_comics_theoatmeal.php b/plugins/af_comics/filters/af_comics_theoatmeal.php new file mode 100644 index 000000000..4dd4003c8 --- /dev/null +++ b/plugins/af_comics/filters/af_comics_theoatmeal.php @@ -0,0 +1,31 @@ + $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); + + $doc = new DOMDocument(); + + if ($res && $doc->loadHTML($res)) { + $xpath = new DOMXPath($doc); + $basenode = $xpath->query('//div[@id="comic"]//img')->item(0); + + if ($basenode) { + $article["content"] = $doc->saveHTML($basenode); + } + } + + return true; + } + + return false; + } +}