From 5cebb6fd72f558ffbfafa2dfabb09b7c430db6f9 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Tue, 2 Apr 2024 10:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E7=94=A8rssSplit=E7=94=A8=E6=9D=A5?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=88=AA=E5=8F=96RSS=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 默认为sentence,为截取文章第一句话。 --- Gmeek.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Gmeek.py b/Gmeek.py index 1d27dc5..f3fb96f 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -71,7 +71,7 @@ class GMEEK(): os.mkdir(self.post_dir) def defaultConfig(self): - dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssMode":"sentence"} + dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence"} config=json.loads(open('config.json', 'r', encoding='utf-8').read()) self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') @@ -283,16 +283,14 @@ class GMEEK(): if issue.body==None: self.blogBase[listJsonName][postNum]["description"]='' else: - if self.blogBase["rssMode"]=="sentence": + if self.blogBase["rssSplit"]=="sentence": if self.blogBase["i18n"]=="CN": period="。" else: period="." - self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period - elif self.blogBase["rssMode"]=="all": - self.blogBase[listJsonName][postNum]["description"]=issue.body else: - self.blogBase[listJsonName][postNum]["description"]='' + period=self.blogBase["rssSplit"] + self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period self.blogBase[listJsonName][postNum]["top"]=0 for event in issue.get_events():