Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extract_from_meta(self, element: HtmlElement) -> str:
"""
一些很规范的新闻网站,会把新闻的发布时间放在 META 中,因此应该优先检查 META 数据
:param element: 网页源代码对应的Dom 树
:return: str
"""
for xpath in PUBLISH_TIME_META:
publish_time = element.xpath(xpath)
if publish_time:
return ''.join(publish_time)
return ''