diff --git a/post_parser.py b/post_parser.py index 200e7b8..1b8d416 100644 --- a/post_parser.py +++ b/post_parser.py @@ -306,42 +306,6 @@ class PostParser: html_content = [] data = self.process_message(message)['html'] - # Add CSS styles - html_content.append(''' - -''') - html_content.append(f'
{data["header"]}
') html_content.append(f'
{data["media"]}
') html_content.append(f'
{data["body"]}
') @@ -361,7 +325,7 @@ class PostParser: flags = self._extract_flags(message) if flags: - return f'🏷 {", ".join(flags)}' + return f'🏷 {" 🏷".join(flags)}' return '' def process_message(self, message: Message) -> Dict[Any, Any]: @@ -611,7 +575,6 @@ class PostParser: try: parts = [] - # First line: reactions and views reactions_html = "" views_html = "" if reactions := getattr(message, "reactions", None): @@ -619,24 +582,24 @@ class PostParser: # Replace None or empty emoji with replacement character emoji = reaction.emoji if emoji is None or emoji == "None" or emoji == "": - emoji = "��" # Question mark as replacement for missing emojis - reactions_html += f'{emoji} {reaction.count}' - reactions_html = reactions_html.rstrip() + emoji = "�" # Question mark as replacement for missing emojis + reactions_html += f'{emoji} {reaction.count} ' + reactions_html = reactions_html.strip() if views := getattr(message, "views", None): - views_html = f'👁 {views}' + views_html = f'{views} 👁' - # Combine reactions and views with proper spacing + # Combine reactions and views on the same line if reactions_html or views_html: - parts.append(f'
{reactions_html} {views_html}
') + parts.append(f'{reactions_html} | {views_html}') - # Second line: date and links + # Add date and links on the same line second_line_parts = [] # Format date as DD/MM/YY, HH:MM:SS if message.date: formatted_date = message.date.strftime("%d/%m/%y, %H:%M:%S") - second_line_parts.append(f'{formatted_date}') + second_line_parts.append(formatted_date) # Add links channel_identifier = self.get_channel_username(message) @@ -646,25 +609,20 @@ class PostParser: if channel_identifier.startswith('-100'): # For channels with only ID channel_id = channel_identifier[4:] # Remove '-100' prefix for web links - links.append(f'Open in Telegram') - links.append(f'Open in Web') + links.append(f'Open in Telegram') + links.append(f'Open in Web') else: # For channels with username - links.append(f'Open in Telegram') - links.append(f'Open in Web') + links.append(f'Open in Telegram') + links.append(f'Open in Web') if Config['show_bridge_link']: token = Config['token'] - links.append(f'Open in Bridge') + links.append(f'Open in Bridge') second_line_parts.extend(links) if second_line_parts: - spacer = " " - parts.append(f'') + parts.append(' | '.join(second_line_parts)) - # Third line: flags (if any) - if flags := self._format_flags(message): - parts.append(f'
{flags}
') - - result_html = '\n'.join(parts) if parts else None + result_html = '
'.join(parts) if parts else None return self._sanitize_html(result_html) if result_html else None except Exception as e: