From 9841a4d068a7150c32aa40986e49b5c3434a046e Mon Sep 17 00:00:00 2001 From: ye Date: Sun, 26 Nov 2023 09:06:25 +0800 Subject: [PATCH] fix the the problem that metadata_provider/douban.py can't get tags info --- cps/metadata_provider/douban.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cps/metadata_provider/douban.py b/cps/metadata_provider/douban.py index 8e27e82e..39c71cc7 100644 --- a/cps/metadata_provider/douban.py +++ b/cps/metadata_provider/douban.py @@ -169,7 +169,8 @@ class Douban(Metadata): ), ) - html = etree.HTML(r.content.decode("utf8")) + decode_content = r.content.decode("utf8") + html = etree.HTML(decode_content) match.title = html.xpath(self.TITTLE_XPATH)[0].text match.cover = html.xpath( @@ -184,7 +185,7 @@ class Douban(Metadata): if len(tag_elements): match.tags = [tag_element.text for tag_element in tag_elements] else: - match.tags = self._get_tags(html.text) + match.tags = self._get_tags(decode_content) description_element = html.xpath(self.DESCRIPTION_XPATH) if len(description_element):