From 5e2e881d0408bafc7b8f2f4f88cd93260bcab368 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Thu, 21 Dec 2023 10:41:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=ADrss=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Gmeek.py b/Gmeek.py index bba293e..0e475c0 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -175,7 +175,7 @@ class GMEEK(): feed.description(self.blogBase["subTitle"]) feed.link(href=self.blogBase["homeUrl"]) feed.image(url=self.blogBase["avatarUrl"],title="avatar", link=self.blogBase["homeUrl"]) - feed.pubDate(time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) + # feed.pubDate(time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) feed.copyright(self.blogBase["title"]) feed.managingEditor(self.blogBase["title"]) feed.webMaster(self.blogBase["title"]) @@ -197,6 +197,20 @@ class GMEEK(): item.link(href=self.blogBase["homeUrl"]+"/"+self.blogBase["postListJson"][num]["postUrl"]) item.pubDate(time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(self.blogBase["postListJson"][num]["createdAt"]))) + if os.path.exists(self.root_dir+'rss.xml'): + feed.rss_file(self.root_dir+'new.xml') + new=open(self.root_dir+'new.xml','r',encoding='utf-8').read() + new=re.sub(r'.*?','',new) + + old=open(self.root_dir+'rss.xml','r',encoding='utf-8').read() + old=re.sub(r'.*?','',old) + + os.remove(self.root_dir+'new.xml') + if new==old: + print("====== rss xml exist======") + return + + print("====== create rss xml ======") feed.rss_file(self.root_dir+'rss.xml') def addOnePostJson(self,issue):