From 068a9401c33a78c3206a07c7a0ab9ceaf3998004 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 29 Jun 2023 08:31:10 +0300 Subject: extract category to article tag --- init.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'init.php') diff --git a/init.php b/init.php index d653a95..acc5caa 100644 --- a/init.php +++ b/init.php @@ -276,6 +276,15 @@ class Af_Lemmy extends Plugin { if (@$doc->loadHTML($article["content"])) { $xpath = new DOMXPath($doc); + $categories = []; + $category_links = $xpath->query('//a[contains(@href, "/c/")]'); + + foreach ($category_links as $link) { + array_push($categories, $link->textContent); + } + + array_push($article["tags"], ...FeedItem_Common::normalize_categories($categories)); + $found = $this->inline_stuff($article, $doc, $xpath, $origin_domain); $node = $doc->getElementsByTagName('body')->item(0); -- cgit v1.2.3