From 713ab51dcc7ff5ec88e1f9b4def8c30ae0323b7c Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Mon, 24 Mar 2025 16:59:44 +0300 Subject: [PATCH] Refactor PostParser --- post_parser.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/post_parser.py b/post_parser.py index 04c2330..fa914f7 100644 --- a/post_parser.py +++ b/post_parser.py @@ -400,10 +400,7 @@ class PostParser: else: text = '' text = text.replace('\n', '
') # Replace newlines with
- # Add hyperlinks to raw URLs only if original text is short - if len((message.text or message.caption or '').strip()) <= 10: - text = self._add_hyperlinks_to_raw_urls(text) - + text = self._add_hyperlinks_to_raw_urls(text) if text: # Message text content_body.append(f'
{text}
') @@ -462,7 +459,8 @@ class PostParser: if webpage := getattr(message, "web_page", None): # Web page preview if webpage_html := self._format_webpage(webpage, message): - content_media.append(webpage_html) + if len((message.text or message.caption or '').strip()) <= 10: + content_media.append(webpage_html) html_media = '\n'.join(content_media) html_media = self._sanitize_html(html_media)