新闻
This commit is contained in:
@@ -287,11 +287,14 @@ class RmrbCrawler(BaseCrawler):
|
||||
|
||||
if parser_func is None:
|
||||
logger.error(f"未找到对应解析器,category={category}, url={url}")
|
||||
return NewsItem(
|
||||
url=url,
|
||||
executeStatus=0,
|
||||
executeMessage=f"不支持的新闻类型: {category}"
|
||||
)
|
||||
parser_func = self.parse_base_news_detail
|
||||
# return NewsItem(
|
||||
# url=url,
|
||||
# contentRows=[],
|
||||
# title="",
|
||||
# executeStatus=0,
|
||||
# executeMessage=f"不支持的新闻类型: {category}"
|
||||
# )
|
||||
|
||||
# 调用对应的解析方法(注意:这些方法是实例方法,需通过 self 调用)
|
||||
return parser_func(url)
|
||||
@@ -638,5 +641,16 @@ class RmrbCrawler(BaseCrawler):
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"解析新闻详情失败 [{url}]: {str(e)}")
|
||||
return NewsItem(
|
||||
title="",
|
||||
contentRows=[],
|
||||
url=url,
|
||||
publishTime="",
|
||||
author="",
|
||||
source="人民网",
|
||||
category="",
|
||||
executeStatus=0,
|
||||
executeMessage=f"解析新闻详情失败: {str(e)}"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user