From 28921cd098b803090f02047e608045de01cad70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristi=C3=A1n=20Sokolsk=C3=BD?= Date: Mon, 9 Nov 2026 02:38:37 +0000 Subject: [PATCH] Aktualizovat upraveny_pubcrawler/urls.py --- upraveny_pubcrawler/urls.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/upraveny_pubcrawler/urls.py b/upraveny_pubcrawler/urls.py index fddbf38..ad80814 100644 --- a/upraveny_pubcrawler/urls.py +++ b/upraveny_pubcrawler/urls.py @@ -2,11 +2,9 @@ import re from urllib.parse import urlsplit from ...common.urls import normalize_url - - ARTICLE_EXPERT = re.compile(r"^/ask-an-expert/[^/]+/[^/]+/?$", re.I) - ARTICLE_FORUM = re.compile(r"^/forum/[^/]+/[^/]+/?$", re.I) +ARTICLE_BLOG = re.compile(r"^/blogs/[^/]+/(message|article)/[^/]+/?$", re.I) def normalize(url, base="https://www.modrykonik.sk/"): @@ -16,7 +14,7 @@ def normalize(url, base="https://www.modrykonik.sk/"): def article_id(url): path = urlsplit(url).path - m = ARTICLE_EXPERT.match(path) or ARTICLE_FORUM.match(path) + m = ARTICLE_EXPERT.match(path) or ARTICLE_FORUM.match(path) or ARTICLE_BLOG.match(path) return m.group(0) if m else None @@ -41,14 +39,22 @@ def kind(url): return "article_expert" return None - if segments[0] == "forum": + if len(segments) >= 3 and segments[1] not in {"category", "topics"}: + return "article_forum" + + if len(segments) <= 2 or segments[1] in {"category", "topics"}: + return "listing" + + return None + + if segments[0] == "blogs": if len(segments) == 1: return "listing" if len(segments) == 2: return "listing" - if len(segments) == 3: - return "article_forum" + if len(segments) >= 4 and segments[2] in {"message", "article"}: + return "article_blog" return None return None \ No newline at end of file