use html
This commit is contained in:
parent
1636f68819
commit
1ed8b84565
9
Gmeek.py
9
Gmeek.py
@ -8,7 +8,7 @@ import shutil
|
|||||||
import urllib
|
import urllib
|
||||||
import requests
|
import requests
|
||||||
import argparse
|
import argparse
|
||||||
from bs4 import BeautifulSoup
|
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
|
||||||
@ -160,12 +160,7 @@ class GMEEK():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if '<code class="notranslate">Gmeek-html' in post_body:
|
if '<code class="notranslate">Gmeek-html' in post_body:
|
||||||
soup = BeautifulSoup(post_body, "html.parser")
|
post_body = html.unescape(re.sub(r'<code class="notranslate">Gmeek-html(.*?)</code>',r'\1',post_body,flags=re.DOTALL))
|
||||||
code_tags = soup.find_all("code", class_="notranslate")
|
|
||||||
for code_tag in code_tags:
|
|
||||||
if code_tag.text.startswith("Gmeek-html"):
|
|
||||||
code_tag.replace_with(code_tag.text.replace("Gmeek-html", "").strip())
|
|
||||||
post_body=soup
|
|
||||||
|
|
||||||
postBase["postTitle"]=issue["postTitle"]
|
postBase["postTitle"]=issue["postTitle"]
|
||||||
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]
|
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]
|
||||||
|
|||||||
@ -3,5 +3,4 @@ requests
|
|||||||
xpinyin
|
xpinyin
|
||||||
feedgen
|
feedgen
|
||||||
Jinja2
|
Jinja2
|
||||||
beautifulsoup4
|
|
||||||
transliterate
|
transliterate
|
||||||
Loading…
Reference in New Issue
Block a user