# 简述:因为使用正则提取内容时,内容中会有很多特殊的编码字符(如上图),正则容易误伤
html_data = execjs.eval(f"{{{asd}}}")['content'] # 把字符串转换为js格式,并提取字符串中的content内容,f为python3中内置字符串格式化方法f-string
print(etree.HTML(html_data).xpath('string(.)')) # 使用xpath获取content中的所有字符串
# 简述:因为使用正则提取内容时,内容中会有很多特殊的编码字符(如上图),正则容易误伤
html_data = execjs.eval(f"{{{asd}}}")['content'] # 把字符串转换为js格式,并提取字符串中的content内容,f为python3中内置字符串格式化方法f-string
print(etree.HTML(html_data).xpath('string(.)')) # 使用xpath获取content中的所有字符串