From 86300cd116b88e254cda79ac06d5b2098a72b4fb Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Tue, 4 Mar 2025 03:04:25 +1000 Subject: [PATCH] Add link detection flag to post parsing --- post_parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/post_parser.py b/post_parser.py index 09b1ebf..52e93e6 100644 --- a/post_parser.py +++ b/post_parser.py @@ -241,6 +241,10 @@ class PostParser: if re.search(r'(?i)(#реклама|#промо|О\s+рекламодателе|партнерский\s+пост|по\s+промокоду|erid)', message_text): flags.append("advert") + # Check if the message contains any http/https links in text or href attributes + if re.search(r'https?://[^\s<>"\']+', message_text) or re.search(r'href=["\']https?://[^"\']+["\']', message_text): + flags.append("link") + try: # Find links with a '+' after t.me/ indicating a hidden channel link. hidden_links = re.findall(r'https?://(?:www\.)?t\.me/\+([A-Za-z0-9]+)', message_text)