add isbn identifier

This commit is contained in:
niu_he 2023-01-02 13:02:44 +08:00 committed by GitHub
parent d693bc75fc
commit 21f8e55b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -167,6 +167,8 @@ class DoubanBookHtmlParser:
book.publishedDate = self.get_publish_date(self.get_tail(element)) book.publishedDate = self.get_publish_date(self.get_tail(element))
elif text.startswith("丛书"): elif text.startswith("丛书"):
book.series = self.get_text(element.getnext()) book.series = self.get_text(element.getnext())
elif text.startswith("ISBN"):
book.identifiers["isbn"] = self.get_tail(element)
summary_element = html.xpath("//div[@id='link-report']//div[@class='intro']") summary_element = html.xpath("//div[@id='link-report']//div[@class='intro']")
if len(summary_element): if len(summary_element):
book.description = etree.tostring(summary_element[-1], encoding="utf8").decode("utf8").strip() book.description = etree.tostring(summary_element[-1], encoding="utf8").decode("utf8").strip()