fix translate py
This commit is contained in:
parent
05b2a82559
commit
36c7baab8d
1 changed files with 6 additions and 1 deletions
|
@ -48,6 +48,7 @@ except ET.ParseError as err:
|
||||||
translator = Translator()
|
translator = Translator()
|
||||||
|
|
||||||
atom_ns = {"ns": "http://www.w3.org/2005/Atom"}
|
atom_ns = {"ns": "http://www.w3.org/2005/Atom"}
|
||||||
|
cont_ns = {"cont": "http://purl.org/rss/1.0/modules/content/"}
|
||||||
|
|
||||||
def translate_string(to_translate):
|
def translate_string(to_translate):
|
||||||
try:
|
try:
|
||||||
|
@ -72,6 +73,10 @@ def process_article(article):
|
||||||
if title is not None:
|
if title is not None:
|
||||||
title.text = translate_string(title.text)
|
title.text = translate_string(title.text)
|
||||||
|
|
||||||
|
# RSS.
|
||||||
|
contents = article.find("cont:encoded", cont_ns)
|
||||||
|
|
||||||
|
if contents is None:
|
||||||
# RSS.
|
# RSS.
|
||||||
contents = article.find("description")
|
contents = article.find("description")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue