diff --git a/rssbot.py b/rssbot.py index ee48c38..fa1efca 100644 --- a/rssbot.py +++ b/rssbot.py @@ -27,7 +27,7 @@ from hashl import md5WithBase64 from enum import Enum from rsstempdict import rssMetaInfo, rssMetaList from random import randrange -from textc import textc +from textc import textc, removeEmptyLine from re import search, I from rsschecker import RSSCheckerThread from rsslist import getInlineKeyBoardForRSSList, InlineKeyBoardForRSSList, getInlineKeyBoardForRSSInList, getTextContentForRSSInList @@ -167,7 +167,7 @@ class main: text.addtotext( f"""{escape(content['link'])}""") if config.show_content and 'description' in content and content['description'] is not None and content['description'] != '': - text.addtotext(content['description']) + text.addtotext(removeEmptyLine(content['description'])) def getListCount(content: dict, key: str): if key not in content or content[key] is None: diff --git a/textc.py b/textc.py index 74326c3..5935408 100644 --- a/textc.py +++ b/textc.py @@ -36,3 +36,20 @@ def timeToStr(t: int) -> str: te = te + op + \ f'{int(abs(timezone)/3600):02}:{int(abs(timezone)%3600/60):02}' return te + + +def removeEmptyLine(s: str) -> str: + l = s.splitlines(False) + r = [] + for v in l: + if v != '': + r.append(v) + f = True + z = '' + for v in r: + if f: + f = False + z = v + else: + z = z + '\n' + v + return z