diff options
author | Andrew Dolgov <[email protected]> | 2023-06-29 08:31:10 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-06-29 08:31:26 +0300 |
commit | 068a9401c33a78c3206a07c7a0ab9ceaf3998004 (patch) | |
tree | 7c54b4fbba128e46300d9e289a3658e95ba7807a | |
parent | 94cf638799dfce6fe746aa84ac4a698aebf38828 (diff) |
extract category to article tag
-rw-r--r-- | init.php | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |