Skip to content

Commit a84e30f

Browse files
author
zp
committed
fix: Support more article styles
1 parent 5a31883 commit a84e30f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

magic_html/extractors/weixin_extractor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def extract(self, html="", base_url="") -> dict:
2626

2727
# 文章区域
2828
try:
29-
body_tree = tree.xpath('.//*[@id="img-content"]')[0]
29+
body_tree_match = tree.xpath('.//*[@id="img-content"]')
30+
if not body_tree_match:
31+
body_tree_match = tree.xpath('.//*[@id="js_content"]')
32+
body_tree = body_tree_match[0]
3033
except:
3134
raise ValueError
3235

0 commit comments

Comments
 (0)