部分tags解析报错问题

This commit is contained in:
gary.fu 2022-01-31 14:10:59 +08:00
parent 4b8ca56356
commit 7ada6b7c5a
1 changed files with 1 additions and 1 deletions

View File

@ -135,7 +135,7 @@ class DoubanBookHtmlParser:
book['description'] = etree.tostring(summary_element[-1], encoding="utf8").decode("utf8").strip() book['description'] = etree.tostring(summary_element[-1], encoding="utf8").decode("utf8").strip()
tag_elements = html.xpath("//a[contains(@class, 'tag')]") tag_elements = html.xpath("//a[contains(@class, 'tag')]")
if len(tag_elements): if len(tag_elements):
book['tags'] = [tag_element.text.strip() for tag_element in tag_elements] book['tags'] = [self.get_text(tag_element) for tag_element in tag_elements]
book['source'] = { book['source'] = {
"id": PROVIDER_ID, "id": PROVIDER_ID,
"description": PROVIDER_NAME, "description": PROVIDER_NAME,