fix translate py
This commit is contained in:
parent
05b2a82559
commit
36c7baab8d
@ -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:
|
||||||
@ -73,7 +74,11 @@ def process_article(article):
|
|||||||
title.text = translate_string(title.text)
|
title.text = translate_string(title.text)
|
||||||
|
|
||||||
# RSS.
|
# RSS.
|
||||||
contents = article.find("description")
|
contents = article.find("cont:encoded", cont_ns)
|
||||||
|
|
||||||
|
if contents is None:
|
||||||
|
# RSS.
|
||||||
|
contents = article.find("description")
|
||||||
|
|
||||||
if contents is None:
|
if contents is None:
|
||||||
# ATOM.
|
# ATOM.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user