diff --git a/src/parser/content/simple_answer.py b/src/parser/content/simple_answer.py index 7be7406..8adc08f 100644 --- a/src/parser/content/simple_answer.py +++ b/src/parser/content/simple_answer.py @@ -53,7 +53,9 @@ def parse_href_info(self): Debug.logger.debug(u'答案更新日期未找到') return href_tag = self.content.find('a', class_='answer-date-link') - if not href_tag: + if (not href_tag) and (self.body): + # 知乎站点有bug,会显示作者的匿名回答,导致self.body也可能为空 + # 已向官方反馈 href_tag = self.body.find('a', class_='answer-date-link') # 再试一次 if not href_tag: Debug.logger.debug(u'问题id,答案id未找到') diff --git a/unit/parser_unit.py b/unit/parser_unit.py index 7c2b8aa..afd9ba2 100644 --- a/unit/parser_unit.py +++ b/unit/parser_unit.py @@ -20,7 +20,7 @@ is_info = 0 -kind = 'collection' #直接在这里替换类别即可完成测试。可供测试的类别见字典键值 +kind = 'author' #直接在这里替换类别即可完成测试。可供测试的类别见字典键值 unit ={ 'answer':{ 'src_answer':'./unit_html/single_answer.html', diff --git a/unit/unit_html/author.html b/unit/unit_html/author.html index e48a06f..db813f8 100644 --- a/unit/unit_html/author.html +++ b/unit/unit_html/author.html @@ -1,20 +1,20 @@ - +
-
在涉及