Update Gmeek.py

This commit is contained in:
Meekdai 2024-05-28 21:40:26 +08:00
parent 88e434cb26
commit a7e4e685c0

View File

@ -8,7 +8,6 @@ import shutil
import urllib import urllib
import requests import requests
import argparse import argparse
import html
from github import Github from github import Github
from xpinyin import Pinyin from xpinyin import Pinyin
from feedgen.feed import FeedGenerator from feedgen.feed import FeedGenerator
@ -159,8 +158,11 @@ class GMEEK():
f'color: var(--fgColor-{style},var(--color-{style}-fg));}}</style>' f'color: var(--fgColor-{style},var(--color-{style}-fg));}}</style>'
) )
if '##{"html":' in post_body: if '<code class="notranslate">Gmeek-html' in post_body:
post_body=re.sub(r'##\{"html":"(.*?)"\}##',lambda x: html.unescape(x.group(1)),post_body,flags=re.DOTALL) pattern = r'<code class="notranslate">Gmeek-html>(.*?)</code>'
post_body=re.sub(pattern, r'\1', post_body)
<code class="notranslate">Gmeek-html<img src='https://picsum.photos/200'></code>
postBase["postTitle"]=issue["postTitle"] postBase["postTitle"]=issue["postTitle"]
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"] postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]