[twitter]推文翻译:若无需翻译则返回空
This commit is contained in:
parent
d5be45ec95
commit
4d2035b9fa
@ -192,9 +192,9 @@ class TwitterSpider(scrapy.Spider):
|
|||||||
item['es_catalog1'] = author_full_text
|
item['es_catalog1'] = author_full_text
|
||||||
# 判断是否需要翻译
|
# 判断是否需要翻译
|
||||||
if needs_translation(author_full_text):
|
if needs_translation(author_full_text):
|
||||||
item['es_content'] = translate_single(author_full_text) # TODO 翻译
|
item['es_catalog2'] = translate_single(author_full_text)
|
||||||
else:
|
else:
|
||||||
item['es_content'] = url_content
|
item['es_catalog2'] = ''
|
||||||
legacy = result['quoted_status_result']['result']['legacy']
|
legacy = result['quoted_status_result']['result']['legacy']
|
||||||
self.logger.info('采集引用推文原文信息')
|
self.logger.info('采集引用推文原文信息')
|
||||||
elif 'retweeted_status_result' in legacy:
|
elif 'retweeted_status_result' in legacy:
|
||||||
@ -208,7 +208,7 @@ class TwitterSpider(scrapy.Spider):
|
|||||||
if needs_translation(url_content):
|
if needs_translation(url_content):
|
||||||
item['es_content'] = translate_content_with_paragraphs(url_content) # TODO 翻译
|
item['es_content'] = translate_content_with_paragraphs(url_content) # TODO 翻译
|
||||||
else:
|
else:
|
||||||
item['es_content'] = url_content
|
item['es_content'] = ''
|
||||||
# 下载图片
|
# 下载图片
|
||||||
image_url_list = []
|
image_url_list = []
|
||||||
if 'entities' in legacy and 'media' in legacy['entities']:
|
if 'entities' in legacy and 'media' in legacy['entities']:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user