This commit is contained in:
2025-11-13 11:04:40 +08:00
parent e55a52f20b
commit 2982d53800
8 changed files with 45 additions and 31 deletions

View File

@@ -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)}"
)