采用rssSplit用来自定义截取RSS输出

默认为sentence,为截取文章第一句话。
This commit is contained in:
Meekdai 2024-04-02 10:02:29 +08:00
parent aa86583194
commit 5cebb6fd72

View File

@ -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():