diff --git a/post_parser.py b/post_parser.py index 0865e87..c0bae76 100644 --- a/post_parser.py +++ b/post_parser.py @@ -600,19 +600,19 @@ class PostParser: forward_html = self._format_forward_info(message) reply_html = self._format_reply_info(message) - if text_html or poll_html: - content_body.append(f'
') - if forward_html: content_body.append(forward_html) # Forward info - if reply_html: content_body.append(reply_html) # Reply info - content_body.append(f'{text_html}') + + content_body.append(f'
') + if forward_html: content_body.append(forward_html) # Forward info + if reply_html: content_body.append(reply_html) # Reply info + if text_html: content_body.append(f'{text_html}') - content_body.append(f'
') - content_body.append(f'{self._generate_html_media(message)}') - content_body.append(f'
') + content_body.append(f'
') + content_body.append(f'{self._generate_html_media(message)}') + content_body.append(f'
') - if poll_html: content_body.append(poll_html) # Poll - if message.forward_origin: content_body.append(f"
--- Forwarded post end ---") # Forward info end - content_body.append(f'

') + if poll_html: content_body.append(poll_html) # Poll + if message.forward_origin: content_body.append(f"
--- Forwarded post end ---") # Forward info end + content_body.append(f'

') html_body = '\n'.join(content_body) html_body = self._sanitize_html(html_body) @@ -635,7 +635,6 @@ class PostParser: logger.debug(f"Collected media file: {channel_username}/{message.id}/{file_unique_id}") - # Check if document is a PDF file if (message.media == MessageMediaType.DOCUMENT and message.document is not None and hasattr(message.document, 'mime_type') and