部分tags解析报错问题
This commit is contained in:
parent
4b8ca56356
commit
7ada6b7c5a
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue